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.

hardikJain5 | 258 |

CodeBuddy | 250 |

bhatabhi554 | 232 |

Akkki111 | 197 |

clone | 174 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1236 |

SumitSingh27 | 1127 |

mazumderrohit8 | 1124 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4591 |

Quandray | 4444 |

Login to report an issue on this page.