#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long int i, j, n, t, m, k, l, mxx;
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    n % 2 == 0 ? j = n / 2 : j = n / 2 + 1;
    l = j / m;
    if (j % m != 0) l++;
    i = j % m;
    if (i == 0) i = m;
    cout << max((l - 1) * (k + m) + i, n) << endl;
  }
  return 0;
}
