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