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.

geetyadav | 82 |

hari32147 | 76 |

AdityaRaj9 | 75 |

yashrana1 | 74 |

giavytrinh98 | 64 |

abducodes | 839 |

harshtyagi36 | 417 |

vamsikrishna55 | 323 |

sandipbhaumik | 321 |

Akhil varma | 314 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.