#include "bits/stdc++.h"
using namespace std;

#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x),end(x)
#define sz(x) int(x.size())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

const int N = 2069;
double dp[N][N];

int main(){
    cin.tie(0)->sync_with_stdio(0);
    
    rep(i,0,N) dp[i][i] = (double)i/2;
    rep(n,0,N) rep(k,1,n){ 
        double p = dp[n-1][k-1] - dp[n-1][k] + 1;
        p = min(1.,max(0.,p));

        dp[n][k] = p * dp[n-1][k-1] + p - p*p/2 + (1-p) * dp[n-1][k]; 
    }

    int t; cin >> t;

    while(t--){
        ll n,k,d; cin >> n >> k >> d;

        double ans = (double) (d*n)/2 + dp[n-1][k-1] + .5;
        cout << setprecision(15) << ans << '\n'; 
    }
}