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.

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
def round():
	import math
	for _ in range(eval(input())):
		N, B = list(map(int, input().split()))
		x = N%B
		
		if x >= B/2.0:
			print(N + (B-x))
		else:
			print(N-x)

if __name__ == "__main__":
	round()


for _ in range(eval(input())):
	N,B=list(map(int,input().split()))
	S=N
	T=N
	c1,c2=0,0
	while S%B!=0:
		S-=1
		c1+=1
	while T%B!=0:
		T+=1
		c2+=1
	if c2<=c1:
		print(T)
	else:
		print(S)



t=int(input())
nlist=[]
blist=[]
for i in range(t):
	n,b=list(map(int,input().split()))
	m=n%b
	h=float(b)/2
	if(h==m):
		print((int(n+h)))
	elif(h>m):
		print((int(n-m)))
	else:
		print((n+(b-m)))
	


t=int(input())
while t:
	ans=[]
	a,b=list(map(int, input().split()))
	x=list(range(0,a,b))
	x.append(x[len(x)-1]+b)
	x.reverse()
	ans.append(abs(x[0]-a))
	ans.append(abs(x[1]-a))
	print(x[ans.index(min(ans))])
	t=t-1