#include <bits/stdc++.h>
using namespace std;
int T, N;
double ans;
double solve(double n) {
  return -sin(3.14159265359 / n) /
         sqrt(sin(3.14159265359 / n) * sin(3.14159265359 / n) +
              cos(3.14159265359 / n) * cos(3.14159265359 / n) -
              2 * cos(3.14159265359 / n) + 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(9);
  cin >> T;
  while (T--) {
    cin >> N;
    N *= 2;
    double x = 1 / (sin((double)3.14159265359 / N) * 2);
    ans = 2 * x * abs(solve(N));
    cout << fixed << ans << "\n";
  }
  return 0;
}
