#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q > 0) {
    --q;
    long long n, g, b;
    cin >> n >> g >> b;
    if (g >= b || n <= g) {
      cout << n << endl;
    } else {
      long long res = 0;
      long long m = n;
      if (n % 2 != 0) ++n;
      if ((n / 2) % g != 0) {
        res = ((n / 2) / g) * (g + b) + (n / 2) % g;
      } else {
        res = ((n / 2) / g - 1) * (g + b) + g;
      }
      cout << max(m, res) << endl;
    }
  }
  return 0;
}
