for _ in range(int(input())): ans = 1 a = list(map(int, input().split())) for i in a: ans *= i + 1 ans -= 1 print(ans)