import sys input = sys.stdin.readline def calc(k): x2=x-k*y y2=y+k*x if 0<=x2<=D and 0<=y2<=D: return abs(x*y2-y*x2) return 0 T=int(input()) for tests in range(T): D,x,y=map(int,input().split()) if x==0: print(y*D) continue if y==0: print(x*D) continue # (z,w) = (x,y) + k(-y,x) # 0<=x-ky<=D # 0<=y+kx<=D # k<=x/y,k<=(D-y)/x,k>=(x-D)/y,k>=-y/x ANS=0 for i in range(x//y-3,x//y+3): ANS=max(ANS,calc(i)) for i in range((D-y)//x-3,(D-y)//x+3): ANS=max(ANS,calc(i)) for i in range((x-D+y-1)//y-3,(x-D+y-1)//y+3): ANS=max(ANS,calc(i)) for i in range((-y+x-1)//x-3,(-y+x-1)//x+3): ANS=max(ANS,calc(i)) print(ANS)