#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, x, t, g, b, y;
  cin >> t;
  while (t--) {
    cin >> n >> g >> b;
    y = (n + 1) / 2;
    x = g + b;
    long long u, v;
    u = n / x;
    v = n % x;
    long long gn, bn;
    gn = u * g;
    bn = u * b;
    gn += min(g, v);
    long long prev = (u * x + v);
    if (gn >= y) {
      cout << (u * x + v) << "\n";
      continue;
    }
    u = y / g;
    v = y % g;
    long long temp = u * x + v;
    if (v == 0) {
      if (temp - b >= prev) temp -= b;
    }
    cout << temp << "\n";
  }
}
