#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const double PI = acos(-1);
const double PI2 = PI * 2;

/* typedef */

template <typename T>
struct Pt {
  T x, y;

  Pt() {}
  Pt(T _x, T _y) : x(_x), y(_y) {}
  Pt(const Pt& pt) : x(pt.x), y(pt.y) {}

  bool operator==(const Pt pt) const { return x == pt.x && y == pt.y; }
  Pt<T> operator+(const Pt pt) const { return Pt<T>(x + pt.x, y + pt.y); }
  Pt<T> operator-() const { return Pt<T>(-x, -y); }
  Pt<T> operator-(const Pt pt) const { return Pt<T>(x - pt.x, y - pt.y); }
  Pt<T> operator*(T t) const { return Pt<T>(x * t, y * t); }
  Pt<T> operator/(T t) const { return Pt<T>(x / t, y / t); }
  T dot(Pt v) const { return x * v.x + y * v.y; }
  T cross(Pt v) const { return x * v.y - y * v.x; }
  Pt<T> mid(const Pt pt) { return Pt<T>((x + pt.x) / 2, (y + pt.y) / 2); }
  T d2() { return x * x + y * y; }
  double d() { return sqrt(d2()); }

  Pt<T> rot(double th) {
    double c = cos(th), s = sin(th);
    return Pt<T>(c * x - s * y, s * x + c * y);
  }

  bool operator<(const Pt& pt) const {
    return x < pt.x || (x == pt.x && y < pt.y);
  }

  void print(string format) {
    printf(("(" + format + ", " + format + ")\n").c_str(), x, y);
  }
  void print() { print("%.6lf"); }
};

typedef Pt<double> pt;

struct CL {
  pt p;
  double t0, t1;
  void print() {
    printf("CL:(%.6lf,%.6lf), t0=%.6lf, t1=%.6lf\n", p.x, p.y, t0, t1);
  }
};

/* global variables */

/* subroutines */

bool cross_lines(const pt& a0, const pt& da, const pt& b0, const pt& db,
                 CL& cl) {
  double op01 = da.cross(db);
  if (op01 == 0.0) return false; /* need to handle parallel?? */

  pt v = b0 - a0;
  double op0 = v.cross(da);
  double op1 = v.cross(db);

  cl.t0 = op1 / op01;
  cl.t1 = op0 / op01;
  cl.p = db * cl.t1 + b0;

  return (cl.t0 >= 0.0 && cl.t1 >= 0.0 && cl.t1 <= 1.0);
}

/* main */

int main() {
  double r = (double)1.0 / sqrt(3);
  double d30 = PI / 6;

  pt a0(0, 0);
  pt b0(r, 0), db(-cos(d30), sin(d30));
  
  for (;;) {
    int n;
    cin >> n;
    if (n == 0) break;

    if (n % 3 == 0) n /= 3;
    
    int n3 = n * 3;
    double th = PI / n3;
    
    pt da(cos(th), sin(th));
    CL cl;

    cross_lines(a0, da, b0, db, cl);
    //cl.print();
    double ar = b0.cross(cl.p) * n3;

    printf("%.6lf\n", ar);
  }

  return 0;
}