#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    long long n, g, b;
    cin >> n >> g >> b;
    if (g >= b) {
      cout << n << endl;
      continue;
    }
    long long good_need = n / 2;
    if (n % 2 == 1) good_need += 1;
    good_need -= g;
    long long bad_poss = n / 2;
    long long periods = bad_poss / b;
    if (good_need - periods * g <= 0) {
      cout << n << endl;
      continue;
    }
    good_need -= periods * g;
    long long restperiods = good_need / g;
    long long rest = 0;
    if (good_need % g != 0) {
      rest = good_need % g + b;
    }
    cout << g + (periods + restperiods) * (g + b) + rest << endl;
  }
}
