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