dp = []

def precalc():
    n = 2000
    global dp
    dp = [[0.0] * (n + 1) for i in range(n + 1)]
    dp[1][0] = 0.0
    for i in range(2, n + 1):
        dp[i][0] = dp[i - 1][0] + 0.5
        for j in range(1, n + 1):
            A = 1 + dp[i - 1][j - 1]
            B = dp[i - 1][j]
            dp[i][j] = B + 0.5 + (A - B) * (A - B) / 2.0

def solve():
    n, k, d = map(int, input().split())
    ans = (d - 1) * 0.5 * n + dp[n][k - 1] + 1
    print(f"{ans:.10f}")

precalc()
tests = int(input())
for t in range(tests):
    solve()
