#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, g, b, ans = 0;
    cin >> n >> g >> b;
    long long int p = n / 2 + n % 2;
    ans = p / g * (g + b) + p % g;
    if (p % g == 0) ans -= b;
    cout << (max(ans, n)) << endl;
  }
}
