#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int t;
  scanf("%d\n", &t);
  for (int itr = 0; itr < t; ++itr) {
    int n;
    scanf("%d", &n);
    double len_1 = 1.0, len_2 = 0.0;
    double b_angle = 3.14159265359 / (double)n;
    double angle = b_angle;
    for (int i = 0; i < n / 2; ++i) {
      len_1 += 2.0 * cos(angle);
      len_2 += 2.0 * sin(angle);
      angle += b_angle;
    }
    double th = 3.14159265359 / 4.0, low = 0.0, high = 3.14159265359 / 2.0;
    double a = len_1 * cos(th), b = len_2 * cos(th) + sin(th);
    while (fabs(a - b) > 0.0000000001) {
      if (a > b) {
        low = th;
      } else {
        high = th;
      }
      th = (low + high) / 2.0;
      a = len_1 * cos(th), b = len_2 * cos(th) + sin(th);
    }
    printf("%lf\n", a);
  }
  return 0;
}
