#include<stdio.h> int main() { long int t; scanf("%ld",&t); for(long int j=0;j<t;j++) { long int n,a,b; scanf("%ld %ld %ld",&n,&a,&b); long int i=(n*b)/(a+b); if(((a*i*i)+(b*(n-i)*(n-i)))>((a*(i+1)*(i+1))+(b*(n-i-1)*(n-i-1)))) i=i+1; printf("%ld\n",((a*i*i)+(b*(n-i)*(n-i)))); } }