#include <bits/stdc++.h>
using namespace std;
double across(int n, int num_sides) {
  double ang = M_PI * ((double)num_sides / n) / 2;
  return 0.5 / sin(M_PI / (2 * n)) * sin(ang) * 2;
}
int main() {
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    double arg = (M_PI * (n - 1)) / ((double)2 * n);
    if (n % 2 == 0) {
      cout << setprecision(50) << tan(arg) << "\n";
    } else {
      double r = 0.5 / sin(M_PI / (2 * n));
      double side = r * 2 * sin((M_PI / n * (n - 1)) / 2);
      cout << setprecision(50)
           << sqrt(pow(across(n, n / 2), 2) / (double)2) +
                  sqrt(pow(across(n, n / 2 + 1), 2) / (double)2)
           << "\n";
    }
  }
}
