#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    long long n, g, b;
    cin >> n >> g >> b;
    if (b <= g)
      cout << n << endl;
    else {
      long long sum = 0, len = 2 * g;
      long long lun = n / len;
      if (n % len == 0) {
        lun--;
      }
      long long sheng = n - len * lun;
      sum += lun * (b + g);
      long long c2 = sheng / 2;
      long long yu = lun * (b - g);
      sheng -= min(yu, c2);
      sum += sheng;
      cout << sum << endl;
    }
  }
}
