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