#include <bits/stdc++.h>
#define endl "\n"
#define ooop(i, n) for(int i = 0; i < n; i++)
#define loop(i, n) for(int i = 1; i <= n; i++)
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int t;
cin >> t;
while(t--){
ll n, g, b;
cin >> n >> g >> b;
ll req = (n+1)/2;
ll q = req/g;
ll r = req%g;
ll nes = 0;
if(r == 0) nes = (g+b)*(q-1)+g;
else nes = (g+b)*q+r;
cout << ((nes < n)? n: nes) << endl;
}
return 0;