from math import gcd T = int(input()) def func(nx, ny): left = 0 right = 10**12 while left+1 < right: mid = (left+right)//2 if 0 <= x+nx*mid <= D and 0 <= y+ny*mid <= D: left = mid else: right = mid return left def area(x1, y1, x2, y2, x3, y3): return abs((x1-x3)*(y2-y3)-(x2-x3)*(y1-y3)) for _ in range(T): D, x, y = map(int, input().split()) GCD = gcd(x, y) nx, ny = x//GCD, y//GCD nx1, ny1 = ny, -nx nx2, ny2 = -ny, nx cnt1, cnt2 = func(nx1, ny1), func(nx2, ny2) if cnt1 == cnt2 == 0: print(0) else: xb1, yb1 = x+nx1*cnt1, y+ny1*cnt1 xb2, yb2 = x+nx2*cnt2, y+ny2*cnt2 print(max(area(0, 0, x, y, xb1, yb1), area(0, 0, x, y, xb2, yb2)))