#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, g, b;
    cin >> n >> g >> b;
    long long l = n, r = 1e18, ne = (n + 1) / 2;
    while (l <= r) {
      long long m = (l + r) / 2;
      long long di = g * (m / (g + b));
      di += min(g, m % (g + b));
      if (di < ne)
        l = m + 1;
      else
        r = m - 1;
    }
    cout << l << "\n";
  }
}
