#include <bits/stdc++.h>
using namespace std;
long long t, n, g, b, a, m;
int main() {
  cin >> t;
  while (t--) {
    long long ans = 0;
    cin >> n >> g >> b;
    if (g >= n) {
      cout << n << '\n';
      continue;
    }
    m = ceil(((double)n) / 2);
    a = ceil(((double)m) / g);
    n -= (g + b) * (a - 1);
    m -= (g) * (a - 1);
    ans +=
        (g + b) * (a - 1) + max(min(max(m, (long long)0), max((long long)0, g)),
                                max(n, (long long)0));
    cout << ans << '\n';
  }
}
