t = int(input()) for i in range (t): x,y = map(int,input().split()) value = x+y - (x % y) if x % y == 0: print(x) elif value % y == 0: print(value) else: print(y)