#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int t;
  cin >> t;
  while (t--) {
    ll n, g, b;
    cin >> n >> g >> b;
    ll l = n, r = 1000000000000000005;
    while (l < r) {
      ll m = (l + r) / 2;
      ll cnt = g * (m / (g + b)) + min(m % (g + b), g);
      if (cnt >= (n + 1) / 2)
        r = m;
      else
        l = m + 1;
    }
    cout << l << '\n';
  }
}
