#include <algorithm>
#include <bits/stdc++.h>
#include <iostream>

using namespace std;

vector<vector<double>> dp;

void precalc() {
  const int n = 2000;
  dp.resize(n + 1, vector<double>(n + 1, 0.0));
  dp[1][0] = 0.0;
  for (int i = 2; i <= n; i++) {
    dp[i][0] = dp[i - 1][0] + 0.5;
    for (int j = 1; j <= n; j++) {
      double A = 1 + dp[i - 1][j - 1];
      double B = dp[i - 1][j];
      dp[i][j] = B + 0.5 + (A - B) * (A - B) / 2.0;
    }
  }
}

void solve() {
  int n, k, d;
  cin >> n >> k >> d;
  double ans = (d - 1) * 0.5 * n + dp[n][k - 1] + 1;
  cout << fixed << setprecision(10) << ans << "\n";
}

int main() {
  int tests;
  cin >> tests;
  precalc();
  while (tests-- > 0) {
    solve();
  }
  return 0;
}
