#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(20);
  long long int tt;
  cin >> tt;
  while (tt--) {
    long double n;
    cin >> n;
    long double r, s, c;
    long long int m = n / 2 + 1;
    ;
    vector<long double> sins(m), coss(m);
    coss[0] = 1.0;
    for (auto i = 1; i <= m - 1; i++) {
      sins[i] = sin(i * (180.0 / n) * (3.14159265359 / 180.0));
      coss[i] = cos(i * (180.0 / n) * (3.14159265359 / 180.0));
    }
    s = 0, c = 0;
    for (auto i = 1; i <= m - 1; i++) {
      if (min((s), (c)) < min((sins[i]), (coss[i]))) {
        s = sins[i];
        c = coss[i];
      }
    }
    r = 1.0 / (2.0 * sin((90.0 / n) * (3.14159265359 / 180.0)));
    cout << (sqrt(2) * (c + s) * r) << '\n';
  };
  return 0;
}
