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