Most of the time when rounding a given number, it is customary to round to some multiple of a power of 10. However, there is no reason why we cannot use another multiple to do our rounding to. For example, you could round to the nearest multiple of 7, or the nearest multiple of 3.
Given an integer N and an integer B, round N to the nearest value which is a multiple of B. If N is exactly halfway between two multiples of B, return the larger value.

Input:- First line contains number of test cases and each test case two interger values N and B.

Ouput:- Print the desired output.

SAMPLE INPUT
3
5 10
4 10
100 3

SAMPLE OUTPUT
10
0
99

Explanation

Testcase 3:-100 is closer to 99 than 102.
for _ in range(int(raw_input())):
	n, b = map(int, raw_input().split())
	low = (n / b) * b
	print low if n - low < low + b - n  else low + b