T = int(input()) for _ in range(T): a, b = [int(i) for i in input().split()] print(b + a * b)