#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int q = 0; q < t; ++q) {
    int n;
    cin >> n;
    int k = n / 2 - 1;
    double pi = 3.14159265;
    cout << std::setprecision(10);
    double sum = 0.500000;
    double theta = pi * (n - 1) / n;
    for (int i = 1; i <= k; ++i) {
      sum += sin(i * (pi - theta));
    }
    sum = 2 * sum;
    double a = pi - theta;
    double d = pi - theta;
    double sum1 = sin(k * d / 2) / sin(d / 2) * sin((2 * a + (n - 1) * d) / 2);
    sum1 = (sum1 + 0.5) * 2;
    cout << sum << endl;
  }
}
