#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e19;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<int> v[100001];
  int t;
  cin >> t;
  while (t--) {
    long long n, g, b, a, c, d, r, k, s;
    cin >> n >> g >> b;
    c = n / 2;
    if (n % 2) c++;
    k = c / g;
    if (c % g == 0) k--;
    r = k * (b + g) + (c % g == 0 ? g : c % g);
    a = max(0LL, n - c - k * b);
    r = r + a;
    cout << r << '\n';
  }
}
