#include <bits/stdc++.h>
using namespace std;
double solvre(int n) {
  double ans = 0;
  ans += 1;
  double del = 3.14159265358979 / (n);
  double ang = del;
  while (ang < (3.14159265358979 / 2) - 10e-9) {
    ans += 2 * cos(ang);
    ang += del;
  }
  return ans * cos(del / 4);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    scanf("%d", &n);
    printf("%.10lf\n", solvre(n));
  }
  return 0;
}
