fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int q;
  8. long long n, a, b, a2;
  9.  
  10. cin>>q;
  11. while(q--) {
  12. long long ans = 0;
  13. cin>>n>>a>>b;
  14.  
  15. a2 = a*2;
  16.  
  17. if (a2 < b) {
  18. ans += n*a;
  19. }
  20. else {
  21. ans += n/2 * b + n%2*a;
  22. }
  23.  
  24. cout<<ans<<endl;
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 15232KB
stdin
4
10 1 3
7 3 2
1 1000 1
1000000000000 42 88
stdout
10
9
1000
42000000000000