def f(k, x) dp = Array.new(k + 1, 0) 1.upto(k) do |i| 1.upto(6) do |j| if j > i dp[i] += x else dp[i] += dp[i - j] end end dp[i] = dp[i] / 6.0 + 1 end dp [k] end def solver(k) ok = 10 ** 9 ng = 0 50.times do x = (ok + ng) / 2.0 if f(k, x) <= x ok = x else ng = x end end "%.8f" % ok end T = gets.to_i T.times do n = gets.to_i if n <= 200 puts solver(n) else puts "%.8f" % [Rational(5, 3) + n] end end