T=int(input()) for i in range(T): x, y = map(int,input().split()) j=x while True: if j%y==0: print(j) break else: j+=1