#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n--) {
    long long int m, x, y;
    cin >> m >> x >> y;
    long long int ans = 0;
    long long int num = 0;
    long long int ss = m / 2 / y;
    long long int ssl = m / 2 % y;
    if (ssl) {
      num += (x + y) * ss + x + ssl;
    } else
      num += (x + y) * ss + x;
    if (num >= m) {
      cout << m << endl;
      continue;
    } else {
      m -= num;
      ans += num - ssl + y;
      long long int ws = m / x * (x + y);
      long long int wsa = m % x;
      ans += ws;
      if (wsa)
        cout << ans + y + wsa - y << endl;
      else
        cout << ans - y << endl;
    }
  }
}
