#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 10;
const double PI = atan(1.0) * 4;
int main() {
  int T;
  cin >> T;
  while (T--) {
    double n;
    int m;
    cin >> m;
    n = (double)m;
    double t = PI / n;
    double l = 0.5 / (sin(t / 2.0));
    double p;
    if (m == 3)
      p = n / 4.0 - 0.5;
    else
      p = n / 4.0 - floor(n / 4.0);
    double ans1 = 2.0 * l * cos(p * t);
    double ans2 = 2.0 * l * cos((1.0 - p) * t);
    printf("%.10lf\n", max(ans1, ans2));
  }
  return 0;
}
