#include <bits/stdc++.h>
using namespace std;
long long int digits(long long int n) { return floor(log10(double(n))) + 1; }
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
long long int modularExponentiation(long long int x, long long int n,
                                    long long int M) {
  long long int result = 1;
  while (n > 0) {
    if (n % 2 == 1) {
      result = ((result % M) * (x % M)) % M;
    }
    x = ((x % M) * (x % M)) % M;
    n = n / 2;
  }
  return result % M;
}
long long int d, x, y;
void extendedEuclid(long long int A, long long int B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(B, A % B);
    int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
long long int nCrModp(long long int n, long long int r) {
  if (r > n - r) r = n - r;
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) {
      C[j] = (C[j] + C[j - 1]);
    }
  }
  return C[r];
}
long long int modInverse(long long int A, long long int M) {
  extendedEuclid(A, M);
  return (x % M + M) % M;
}
long long int binarySearch(vector<long long int>& arr, long long int l,
                           long long int r, long long int x) {
  while (l <= r) {
    int m = l + (r - l) / 2;
    if (arr[m] == x) return m;
    if (arr[m] < x)
      l = m + 1;
    else
      r = m - 1;
  }
  return -1;
}
vector<long long int> v;
vector<long long int> SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) v.push_back(p);
  return v;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int total, gd, bd;
    cin >> total >> gd >> bd;
    long long int half = (total + 1) / 2;
    bd = (((half + gd - 1) / gd) - 1) * bd;
    gd = ((half / gd) * gd) + (half % gd);
    long long int num = gd + bd;
    if (num >= total)
      cout << num << endl;
    else
      cout << num + (total - num) << endl;
  }
}
