#ifndef __APPLE__
#include <bits/stdc++.h>
#else
#include <iostream>
#include <vector>
#include <set>
#include "map"
#include "iomanip"
#include "cassert"
#include "numbers"
#include "random"
#endif
using namespace std;
#define all(x) x.begin(), x.end()
#define int long long
typedef long double ld;
const int nm = 1000007;

int N = 2005;
vector<vector<ld>> ans;
void solve() {
    int n, k, d;
    cin >> n >> k >> d;
    cout <<setprecision(20) << fixed << ans[n][k] + (d-1.0)/2 * n << '\n';
}
ld eps = 1e-5;
signed main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    ans.assign(N, vector<ld>(N));
    for (int i = 0; i < N; ++i) {
        ans[i][0] = 0;
        ans[0][i] = 0;
    }
    ld v1=0, v2 = 0;
    auto fnc = [&](ld t) {
        return ((1+t)/2 + v1) * (1-t) + (v2+1) * t;
    };
    for (int i = 1; i < N; ++i) {
        for (int j = 1; j < N; ++j) {
            ld l = 0, r = 1;
            v1 = ans[i-1][j], v2 = ans[i-1][j-1];
            for (int k = 0; k < 40; ++k) {
                ld m = (l+r)/2;
                //ans[i][j] = max(ans[i][j], fnc(k/1000.0));
                if (fnc(m) < fnc(m+eps))
                    l = m;
                else
                    r = m;
            }
            ans[i][j] = fnc(r);
        }
    }
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}
/*

 */