#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    if (n % 2 == 0) {
      double h = 1.0 / tan(3.14159265358979323846264338327950288 / (2 * n));
      printf("%.17g\n", h);
    } else {
      double alpha = 3.14159265358979323846264338327950288 / n;
      double beta =
          (3.14159265358979323846264338327950288 / 2 - (n / 2) * alpha) / 2;
      double a = 1 / (2 * sin(alpha / 2));
      double h = 2 * a * cos(beta);
      printf("%.17g\n", h);
    }
  }
}
