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