#include <bits/stdc++.h>
using namespace std;
void display(vector<int> &a) {
  for (int z : a) cout << z << " ";
  cout << endl;
}
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
const int mod = (int)1e9 + 7;
const long long INF64 = 3e18;
void smxl(long long &a, long long b) {
  if (a < b) a = b;
}
void smnl(long long &a, long long b) {
  if (a > b) a = b;
}
void adsl(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
void misl(long long &a, long long b) {
  a -= b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
void smx(long long &a, long long b) {
  if (a < b) a = b;
}
void smn(long long &a, long long b) {
  if (a > b) a = b;
}
void ads(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
void mis(long long &a, long long b) {
  a -= b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = egcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long mbinp(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1;
  long long ans = mbinp(a, b / 2);
  long long tmp = (ans * ans) % mod;
  if (b % 2) return ((tmp * a) % mod);
  return ((tmp) % mod);
}
long long binp(long long a, long long b) {
  if (b == 0) return 1;
  long long ans = binp(a, b / 2);
  long long tmp = (ans * ans);
  if (b % 2) return ((tmp * a));
  return ((tmp));
}
long long C(int n, int m) {
  long long ret = 1;
  for (int i = 1; i <= m; i++) {
    ret *= (n - i + 1);
    ret /= i;
  }
  return ret;
}
long long overbinp(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      if (res < INF64 / a)
        res *= a;
      else
        return INF64;
    }
    if (b > 1) {
      if (a < INF64 / a)
        a *= a;
      else
        return INF64;
    }
    b >>= 1;
  }
  return res;
}
class BinaryLift {
  vector<vector<int> > binlift;
  int n;

 public:
  BinaryLift(vector<int> rnk, vector<int> par) {
    n = (int)par.size();
    binlift.resize(n);
    for (int i = 0; i < n; i++) binlift[i].resize(20);
    for (int i = 0; i < n; i++) binlift[i][0] = par[i];
    for (int j = 1; j < 20; j++)
      for (int i = 0; i < n; i++) {
        if ((1 << j) < rnk[i])
          binlift[i][j] = binlift[binlift[i][j - 1]][j - 1];
        else
          binlift[i][j] = -1;
      }
  }

 public:
  int get_kth_ancestor(int x, int k) {
    int pt = x;
    for (int i = 19; i >= 0; i--) {
      if (pt == -1) exit(0);
      if (k & (1 << i)) pt = binlift[pt][i];
    }
    return pt;
  }

 public:
  int get_th_ancestor(int x, int k) {
    int pt = x;
    for (int i = 19; i >= 0; i--) {
      if (k & (1 << i)) pt = binlift[pt][i];
    }
    return pt;
  }
};
class SparseTable2D {
  vector<vector<vector<vector<int> > > > sparse;
  vector<vector<int> > inp;
  int m, n;

 private:
  int lg2(int x) {
    int out = 0;
    while ((1 << out) <= x) out++;
    return out - 1;
  }

 public:
  int rmin(int x1, int y1, int x2, int y2) {
    int lenx = x2 - x1 + 1;
    int lx = lg2(lenx) + 1;
    int leny = y2 - y1 + 1;
    int ly = lg2(leny) + 1;
    return min(
        min(sparse[lx][x1][ly][y1], sparse[lx][x1][ly][y2 + 1 - (1 << ly)]),
        min(sparse[lx][x2 + 1 - (1 << lx)][ly][y1],
            sparse[lx][x2 + 1 - (1 << lx)][ly][y2 + 1 - (1 << ly)]));
  }

 public:
  SparseTable2D(vector<vector<int> > input, string param) {
    n = input.size();
    m = input[0].size();
    inp = input;
    if (param == "min") prepromin();
  }

 private:
  void prepromin() {
    int lln, lm;
    lln = lg2(n) + 1;
    lm = lg2(m) + 1;
    sparse.resize(lln);
    for (int i = 0; i < lln; i++) sparse[i].resize(n);
    for (int i = 0; i < lln; i++)
      for (int j = 0; j < n; j++) sparse[i][j].resize(lm);
    for (int i = 0; i < lln; i++)
      for (int j = 0; j < n; j++)
        for (int k = 0; k < lm; k++) sparse[i][j][k].resize(m);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) sparse[0][i][0][j] = inp[i][j];
      for (int j = 1; j < lm; j++)
        for (int k = 0; k + (1 << j) - 1 < m; k++)
          sparse[0][i][j][k] = min(sparse[0][i][j - 1][k],
                                   sparse[0][i][j - 1][k + (1 << (j - 1))]);
    }
    for (int i = 1; i < lln; i++)
      for (int j = 0; j + (1 << i) - 1 < n; j++)
        for (int k = 0; k < lm; k++)
          for (int h = 0; h < m; h++)
            sparse[i][j][k][h] = min(sparse[i - 1][j][k][h],
                                     sparse[i - 1][j + (1 << (i - 1))][k][h]);
  }
};
class SparseTable {
  vector<vector<long long> > sparse;
  int n;
  vector<int> input;

 private:
  int lg2(int x) {
    int out = 0;
    while ((1 << out) <= x) out++;
    return out - 1;
  }

 public:
  int rmaxpos(int left, int right) {
    int len = right - left + 1;
    int lg = lg2(len);
    return (input[sparse[left][lg]] > input[sparse[left + len - (1 << lg)][lg]]
                ? sparse[left][lg]
                : sparse[left + len - (1 << lg)][lg]);
  }

 public:
  int rmaxval(int left, int right) {
    int len = right - left + 1;
    int lg = lg2(len);
    return (input[sparse[left][lg]] > input[sparse[left + len - (1 << lg)][lg]]
                ? input[sparse[left][lg]]
                : input[sparse[left + len - (1 << lg)][lg]]);
  }

 public:
  int rminpos(int left, int right) {
    int len = right - left + 1;
    int lg = lg2(len);
    return (input[sparse[left][lg]] < input[sparse[left + len - (1 << lg)][lg]]
                ? sparse[left][lg]
                : sparse[left + len - (1 << lg)][lg]);
  }

 public:
  int rminval(int left, int right) {
    int len = right - left + 1;
    int lg = lg2(len);
    return (input[sparse[left][lg]] < input[sparse[left + len - (1 << lg)][lg]]
                ? input[sparse[left][lg]]
                : input[sparse[left + len - (1 << lg)][lg]]);
  }

 public:
  long long rsum(int left, int right) {
    long long ans = 0;
    int pos;
    while (left <= right) {
      for (int i = 19; i >= 0; i--)
        if ((1 << i) <= right - left + 1) {
          pos = i;
          break;
        }
      ans += sparse[left][pos];
      left = left + (1 << pos);
    }
    return ans;
  }

 public:
  SparseTable(vector<int> inp, string operation) {
    input = inp;
    n = inp.size();
    if (operation == "min")
      prepromin();
    else if (operation == "max")
      prepromax();
    else if (operation == "sum")
      preprosum();
  }

 private:
  void prepromin() {
    sparse.resize(n);
    int x = lg2(n) + 1;
    for (int i = 0; i < n; i++) sparse[i].resize(x);
    for (int i = 0; i < n; i++) sparse[i][0] = i;
    for (int j = 1; j < x; j++)
      for (int i = 0; i + (1 << (j)) - 1 < n; i++)
        sparse[i][j] =
            (input[sparse[i][j - 1]] < input[sparse[i + (1 << (j - 1))][j - 1]]
                 ? sparse[i][j - 1]
                 : sparse[i + (1 << (j - 1))][j - 1]);
  }
  void prepromax() {
    sparse.resize(n);
    int x = lg2(n) + 1;
    for (int i = 0; i < n; i++) sparse[i].resize(x);
    for (int i = 0; i < n; i++) sparse[i][0] = i;
    for (int j = 1; j < x; j++)
      for (int i = 0; i + (1 << (j)) - 1 < n; i++)
        sparse[i][j] =
            (input[sparse[i][j - 1]] > input[sparse[i + (1 << (j - 1))][j - 1]]
                 ? sparse[i][j - 1]
                 : sparse[i + (1 << (j - 1))][j - 1]);
  }
  void preprosum() {
    sparse.resize(n);
    int x = lg2(n) + 1;
    for (int i = 0; i < n; i++) sparse[i].resize(x);
    for (int i = 0; i < n; i++) sparse[i][0] = input[i];
    for (int j = 1; j < x; j++)
      for (int i = 0; i + (1 << (j)) - 1 < n; i++)
        sparse[i][j] = sparse[i][j - 1] + sparse[i + (1 << (j - 1))][j - 1];
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n % 2)
      cout << fixed << setprecision(7)
           << cos(acos(-1) / (4 * n)) / sin(acos(-1) / (2 * n)) << '\n';
    else
      cout << fixed << setprecision(7)
           << cos(acos(-1) / (2 * n)) / sin(acos(-1) / (2 * n)) << '\n';
  }
}
