T=int(input()) for _ in range(T): D,x,y=map(int,input().split()) base=x**2+y**2 if x==0 or y==0: l=x if y!=0: l=y print(l*l*(D//y)) continue s1=min((D-x)//y,y//x) s2=min((D-y)//x,x//y) #print(base,s1,s2) print(base*max(s1,s2,0))