#include <bits/stdc++.h>
using namespace std;
double sn(double a) {
  double param, result;
  param = a;
  result = sin(param * 3.14159265 / 180.0);
  return result;
}
int Q;
int main() {
  cin >> Q;
  while (Q--) {
    double n;
    cin >> n;
    double e = (180 * (2 * n - 2)) / (n * 2);
    double a = (180 * (2 * n - 2)) / (n * 2);
    double p1 = 0, p2 = 0;
    double n1 = (int)n / 2;
    double n2 = n - n1;
    if ((int)n1 % 2 == 1) {
      p1++;
      n1--;
      a = a - 90;
    } else
      a = a / 2;
    for (double k = 2; k <= n1; k += 2) {
      p1 += 2 * (sn(a));
      a = e - (90 - a) - 90;
    }
    e = (180 * (2 * n - 2)) / (n * 2);
    a = (180 * (2 * n - 2)) / (n * 2);
    if ((int)n2 % 2 == 1) {
      p2++;
      n2--;
      a = a - 90;
    } else
      a = a / 2;
    for (double k = 2; k <= n2; k += 2) {
      p2 += (double)2.0 * (sn(a));
      a = e - (90.0 - a) - 90.0;
    }
    p1 = p1 * (sqrt(2)) / 2;
    p2 = p2 * (sqrt(2)) / 2;
    cout << fixed;
    cout << setprecision(6) << (double)(p1 + p2) << endl;
  }
  return 0;
}
