import std.algorithm, std.conv, std.range, std.stdio, std.string; // allowable-error: 10 ** -12 void main() { auto n = readln.chomp.to!size_t; foreach (_; 0..n) { auto k = readln.chomp.to!long; auto ak = calcAk(k); auto eps = real(10.0 ^^ (-13)); auto lower(real _, real a) { return calcE0(ak[0], a) < a; } auto r = real(1); while (!lower(0, r)) r *= 2; auto m = iota(r / 2, r, eps).assumeSorted!lower.upperBound(0); writefln("%.13f", m.front); } } auto calcAk(T)(T k) { auto p = real(1)/6, u = real(1); auto a = [[p,p,p,p,p,p,u], [u,0,0,0,0,0,0], [0,u,0,0,0,0,0], [0,0,u,0,0,0,0], [0,0,0,u,0,0,0], [0,0,0,0,u,0,0], [0,0,0,0,0,0,u]]; auto i = [[u,0,0,0,0,0,0], [0,u,0,0,0,0,0], [0,0,u,0,0,0,0], [0,0,0,u,0,0,0], [0,0,0,0,u,0,0], [0,0,0,0,0,u,0], [0,0,0,0,0,0,u]]; return repeatedSquare!(real[][], matMul)(a, k, i); } auto calcE0(real[] v, real m) { auto e = [0, m, m, m, m, m, 1]; auto r = real(0); foreach (a, b; lockstep(e, v)) r += a * b; return r; } T[][] matMul(T)(T[][] a, T[][] b) { import std.traits; auto l = b.length, m = a.length, n = b[0].length; auto c = new T[][](m, n); static if (isFloatingPoint!T) { foreach (ref r; c) r[] = T(0); } foreach (i; 0..m) foreach (j; 0..n) foreach (k; 0..l) c[i][j] += a[i][k] * b[k][j]; return c; } T[] matMulVec(T)(T[][] a, T[] b) { import std.traits; auto l = b.length, m = a.length; auto c = new T[](m); static if (isFloatingPoint!T) { c[] = T(0); } foreach (i; 0..m) foreach (j; 0..l) c[i] += a[i][j] * b[j]; return c; } T repeatedSquare(T, alias pred = "a * b", U)(T a, U n, T init) { import std.functional; alias predFun = binaryFun!pred; if (n == 0) return init; static T[] buf = []; if (buf.empty) buf ~= a; auto r = init, i = 0; while (n > 0) { if ((n & 1) == 1) r = predFun(r, buf[i]); if (buf.length == ++i) buf ~= predFun(buf[$-1], buf[$-1]); n >>= 1; } return r; }