#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& a) {
  os << "(" << a.first << ", " << a.second << ")";
  return os;
}
const char newl = '\n';
double const pi = acos(-1);
template <typename T>
vector<vector<T>> prod(vector<vector<T>>& a, vector<vector<T>>& b) {
  vector<vector<T>> ret(a.size(), vector<T>(b[0].size(), 0));
  for (int i = 0; i < a.size(); ++i)
    for (int j = 0; j < b[0].size(); ++j)
      for (int k = 0; k < a[0].size(); ++k) {
        ret[i][j] += a[i][k] * b[k][j];
      }
  return ret;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    n *= 2;
    vector<double> x(n);
    vector<vector<double>> a(1, vector<double>(2)), b(2, vector<double>(2));
    if (n % 4) {
      a[0][0] = a[0][1] = 1 / sqrt(2);
    } else {
      a[0][0] = 0;
      a[0][1] = 1;
    }
    b[0][0] = b[1][1] = cos(2 * pi / n);
    b[1][0] = sin(2 * pi / n);
    b[0][1] = -b[1][0];
    x[0] = 0;
    for (int i = 1; i < n; ++i) {
      x[i] = x[i - 1] + a[0][0];
      a = prod(a, b);
    }
    cout << fixed << setprecision(12)
         << *max_element(x.begin(), x.end()) - *min_element(x.begin(), x.end())
         << newl;
  }
}
