#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 7;
const long long inf = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, g, b;
    cin >> n >> g >> b;
    if (n <= g) {
      cout << n << '\n';
      continue;
    }
    long long x = n / 2 + (n % 2), ans = 0;
    long long res = x / g;
    if (x % g > 0) {
      res++;
    }
    ans += (res - 1) * b + g * (res - 1) + (x - g * (res - 1));
    ans += max((long long)0, n - ans);
    cout << ans << '\n';
  }
}
