#include <bits/stdc++.h>
using namespace std;
double getMinimumSideLength(int n) {
  if (n % 2 == 0) {
    double theta = M_PI / (2.0 * n);
    return 1 / tan(theta);
  } else {
    double N = 2.0 * n;
    return cos(M_PI / (2 * N)) / sin(M_PI / N);
  }
}
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    int n;
    scanf("%d", &n);
    double ans = getMinimumSideLength(n);
    printf("%.9lf\n", ans);
  }
  return 0;
}
