#include <bits/stdc++.h>
using namespace std;
int main()
{
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 cout.tie(NULL);
	long long t,n,a,b;
	cin>>t;
	while(t--)
	  {
		  cin>>n>>a>>b;
		  double p=(double)(n*b)/(a+b);
		   p=round(p);
		  long long ans=p*p*a+(n-p)*(n-p)*b;
		 cout<<ans<<"\n";
	  }
}
Language: C++17