t = read_line.to_i b = 200 len = 1.0 / Math::E / (Math::PI ** 2) / b t.times do n = read_line.to_i sum = Math::E 1.upto(b - 1) do |i| sum += Math.exp(Math.cos(len * i / n)) * 2.0 end sum += Math.exp(Math.cos(len * b / n)) sum *= len / 2 printf("%.10f\n", sum) end