#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n, g, b;
  cin >> t;
  while (t--) {
    cin >> n >> g >> b;
    long long val = (n + 1) / 2;
    long long total = val / g;
    long long sum = total * g;
    if (val % g) {
      total++;
    }
    total--;
    sum += (b * total);
    sum += (val % g);
    if (sum <= n)
      cout << n << endl;
    else
      cout << sum << endl;
  }
  return 0;
}
