#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    long long n, g, b;
    cin >> n >> g >> b;
    long long l = 0, r = 1e18;
    while (r - l > 1) {
      long long m = (l + r) / 2;
      long long good = m / (g + b) * g, bad = m / (g + b) * b;
      if (m % (g + b) >= g) {
        good += g;
        bad += m % (g + b) - g;
      } else {
        good += m % (g + b);
      }
      assert(good + bad == m);
      if (bad + good >= n && good * 2 >= n) {
        r = m;
      } else {
        l = m;
      }
    }
    cout << r << '\n';
  }
  return 0;
}
