#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int main() {
  int t;
  cin >> t;
  while (t--) {
    double n;
    cin >> n;
    n *= 2;
    int m = n;
    if (m % 4 == 0) {
      double ans = 1.0 / tan(180 / n * acos(-1.0) / 180);
      printf("%.10lf\n", ans);
    } else {
      m = (m - 2) / 4;
      double c = 360 / (n * 2);
      double x = 0.5 / sin(c * acos(-1.0) / 180);
      c = 360 / n * m / 2;
      double ans = x * 2 * cos((45 - c) * acos(-1.0) / 180);
      printf("%.10lf\n", ans);
    }
  }
}
