- '''
- # Sample code to perform I/O:
- name = input() # Reading input from STDIN
- print('Hi, %s.' % name) # Writing output to STDOUT
- # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
- '''
- # Write your code here
- from sys import stdin,stdout
- def main():
- T=int(stdin.readline())
- for i in range(T):
- N,A,B=map(int, stdin.readline().split())
- X1=round((B*N)/(A+B))
- Y1=N-X1
- stdout.write(str(A*X1*X1+B*Y1*Y1)+'\n')
- main()