T = int(input()) for _ in range(T): A, B = map(int, input().split()) ans = B + (B * A) print(ans)