Given two numbers N and X, you need to write a program that will output the smallest value of (X*K) which is closest to N. Where K is any positive number greater than zero.

**Input:**

The first line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. The only line of each test case contains two space separated integers N and X.

**Output:**

For each test print the closest value of (X*K) in a new line, where is any positive number greater than zero.

Note: If there are two closest elements then print the bigger one.

**Constraints:**

1<=T<=100

1<=X<=1000

1<=N<=1000

**Example:**

**Input:**

2

9 2

2855 13

**Output:**

10

2860

Author: harsh.agarwal0

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

madhursengar24 | 86 |

PiyushPandey4 | 617 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 448 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.