#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 3e5 + 9;
long long n, g, b, ans;
bool check(long long x) {
  long long d = x / (g + b);
  long long rem = x % (g + b);
  long long u = d * g + min(g, rem);
  long long v = d * b + max(0LL, rem - g);
  long long now = u + min(u, v);
  return now >= n;
}
void solve() {
  cin >> n >> g >> b;
  long long lo = 0, hi = (long long)1e18;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (check(mid))
      hi = mid - 1, ans = mid;
    else
      lo = mid + 1;
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
