#include <bits/stdc++.h>
using namespace std;
void SieveOfEratosthenes(int n, vector<int> &primes) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) primes.push_back(p);
}
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int power(long long int x, long long int y, long long int mod) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2, mod);
  if (y % 2 == 0)
    return (temp * temp) % mod;
  else
    return (((x * temp) % mod) * temp) % mod;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n, g, b;
    cin >> n >> g >> b;
    long long int bad = (n + 1) / 2;
    bad = n - bad;
    long long int good = n - bad;
    long long int k = good / g;
    long long int test = g * k;
    good -= k * g;
    if (k > 0) {
      bad = max(bad - b * (k - 1), 0);
      test += b * (k - 1);
      if (good == 0) {
        test += bad;
        cout << test << endl;
        continue;
      }
      bad = max(bad - b, 0);
      test += b;
      long long int m = min(good, g);
      g -= m;
      good -= m;
      test += m;
      m = min(g, bad);
      g -= m;
      bad -= m;
      test += m;
      test += bad;
      cout << test << endl;
    } else {
      long long int m = min(good, g);
      g -= m;
      good -= m;
      test += m;
      test += bad;
      cout << test << endl;
    }
  }
  return 0;
}
