#include

using namespace std;

int main()

{

long long int t,tot=0,i,n,b,m,k,time;

cin>>t;

for(i=0;i<t;i++)

{

cin>>n>>b>>m;

while(n>0)

{

if(n%2==0)

{

k=n/2;

time=k*m;
if(n==1)
{
b=0;
}
tot=tot+time+b;
n=n-k;
m=m*2;

```
}
else
{
k=(n+1)/2;
time=k*m;
if(n==1)
{
b=0;
}
tot=tot+time+b;
n=n-k;
m=m*2;
}
}
cout<<tot<<endl;
}
return(0);
}
```