#include <bits/stdc++.h>
using namespace std;
int main () {
long long unsigned int x;
cin>>x;
for(long long unsigned int i=0;i<x;i++){
long long unsigned int n,b,m,t=0;
cin>>n>>b>>m;
long long unsigned int nn=0,z;
while(n!=0){
if(n%2==0)
z=n/2;
else
z=(n+1)/2;
while(nn!=z){
t=t+m;
n--;
nn++;
// cout<<t<<' ';
}
if(n!=0)
{ nn=0;
m=m+m;
t=t+b;
}}
cout<<t<<endl;
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.