#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
const int apsz = 26;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
const int maxm = maxn + 10;
long long n, g, b;
int judge(long long x) {
  if (2 * (x * g + g) >= n) return 1;
  return 0;
}
void solve() {
  long long L = 0;
  long long R = n / g + 1;
  while (L < R) {
    long long mid = R - (R - L + 1) / 2;
    if (judge(mid))
      R = mid;
    else
      L = mid + 1;
  }
  long long ans = L * (g + b);
  if (L * 2 * g < n) {
    long long need = n / 2 + n % 2;
    need -= L * g;
    ans += need;
  }
  ans = max(n, ans);
  printf("%lld\n", ans);
}
int main(void) {
  int T;
  scanf("%d", &(T));
  while (T--) {
    scanf("%lld", &(n)), scanf("%lld", &(g)), scanf("%lld", &(b));
    solve();
  }
  return 0;
}
