#include <bits/stdc++.h>
using namespace std;
int n;
int read() {
  int s = 0, w = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') w = -1, c = getchar();
  while (c <= '9' && c >= '0') s = (s << 3) + (s << 1) + c - '0', c = getchar();
  return s * w;
}
double ans = 0.0, pi = acos(-1);
void work() {
  n = read();
  ans = 0.0;
  double t = pi / 4;
  while (-(pi / 2 + 1e-7) <= t) t -= pi / n;
  t += pi / n;
  while (pi / 2 + 1e-7 >= t) ans += cos(t), t += pi / n;
  printf("%.10lf\n", ans);
}
signed main() {
  int T = read();
  while (T--) work();
  return 0;
}
