#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    ll n, g, b;
    cin >> n >> g >> b;
    ll l = n, r = 1e18 + 1337;
    while (l < r) {
      ll m = (l + r) / 2;
      ll num = m / (g + b);
      ll cnt = num * g + min(g, m % (g + b));
      if (cnt < n / 2 + (n & 1))
        l = m + 1;
      else
        r = m;
    }
    cout << l << '\n';
  };
  return 0;
}
