T = int(input()) num_list = [list(map(int, input().split())) for _ in range(T)] def test(A,B): print(B+(A*B)) for i in num_list: test(i[0],i[1])