/*
22:50 - over

 */

#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<climits>
#include<cassert>
#include<iomanip>
#include<map>
#include<set>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define IINF (INT_MAX)
#define EPS (1e-8)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1 
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0
#define equals(a,b) (fabs((a)-(b)) < EPS)

using namespace std;

typedef long double ld;

// Library - template - begin

class Point
{
  public:
  double x,y;

  Point(double x = -IINF,double y = -IINF): x(x),y(y){}

  Point operator + (Point p){return Point(x+p.x,y+p.y);}
  Point operator - (Point p){return Point(x-p.x,y-p.y);}
  Point operator * (double a){return Point(a*x,a*y);}
  Point operator / (double a){return Point(x/a,y/a);}
  Point operator * (Point a){ return Point(x * a.x - y * a.y, x * a.y + y * a.x); }

  bool operator < (const Point& p) const
  {
    return !equals(x,p.x)?x<p.x:y<p.y;
  }

  bool operator == (const Point& p)const
  {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }

};

struct Segment
{
  Point p1,p2;
  Segment(Point p1 = Point(),Point p2 = Point()):p1(p1),p2(p2){}
  bool operator == (const Segment& p)const
  {
    return p.p1 == p1 && p.p2 == p2;
  }
};

typedef Point Vector;
typedef Segment Line;
typedef vector<Point> Polygon;

ostream& operator << (ostream& os,const Point& a)
{
  os << "(" << a.x << "," << a.y << ")";
}

ostream& operator << (ostream& os,const Segment& a)
{
  os << "( " << a.p1 << " , " << a.p2 << " )";
}

double dot(Point a,Point b){ return a.x*b.x + a.y*b.y; }

double cross(Point a,Point b){ return a.x*b.y - a.y*b.x; }

double norm(Point a){ return a.x*a.x+a.y*a.y; }

double abs(Point a){ return sqrt(norm(a)); }

//rad は角度をラジアンで持たせること
Point rotate(Point a,double rad){ return Point(cos(rad)*a.x - sin(rad)*a.y,sin(rad)*a.x + cos(rad)*a.y); }

// 度をラジアンに変換
double toRad(double agl){ return agl*M_PI/180.0; }

// Library - template - end

double R;

Point getMP(Point a,Point b,Point c)
{
  double nm[3] = {norm(a),norm(b),norm(c)};
  double u = 0.5/(a.x*b.y-b.x*a.y+b.x*c.y-c.x*b.y+c.x*a.y-a.x*c.y);
  double x = u * (nm[0]*b.y-nm[1]*a.y+nm[1]*c.y-nm[2]*b.y+nm[2]*a.y-nm[0]*c.y);
  double y = u * (a.x*nm[1]-b.x*nm[0]+b.x*nm[2]-c.x*nm[1]+c.x*nm[0]-a.x*nm[2]);
  R = sqrt((x-a.x)*(x-a.x)+(y-a.y)*(y-a.y)); //半径
  return Point(x,y);
}


int n,V;

int main(){
  //cout << fmod(4.5,3.0) << endl;
  while(cin >> n,n){

    if( n == 1 )
      {
	cout << "0.433013" << endl;
	continue;
      }

    if(n % 3)V = 3 * n;
    else     V = n;

    //cout << "V = " << V << endl;

    double theta = 360.0 / V;
    double theta2 = ( ( 180.0 - theta ) * 0.5 ) - 30.0;
    assert( theta2 >= 0.0 );  

    //cout << "theta = " << theta << " theta2 = " << theta2 << endl;

    Point sp = Point(1,0);
    Point np = rotate(sp,toRad(60.0));
    Point mp = getMP(Point(0,0),sp,np);
    /*
    double h = R  / ( sqrt(3.0) + ( 1.0 / tan( toRad(theta*0.5) ) ) );
    double area2 = ( h * R / 2 ) * V * 2;
    //area2 *= V;
    //cout << "theta = " << theta*0.5 << " =? " << ((n%3)?60/n:180/n) << endl;
    //cout << "V = " << V << endl;
    cout << setiosflags(ios::fixed) << setprecision(7) << area2  << endl;  

    continue;
    */
    np = np - mp;
    Point np2 = rotate(np,toRad(theta));

    //cout << sp  << " " << np << " " << np2 << endl;

    double len = abs(np-np2);
    double L = len * 0.5;
    double theta3 = 180.0 - ( 90.0 + theta2 );
    assert( theta3 >= 0 );
    double L2 = L * sin(toRad(theta2)) / sin(toRad(theta3));

    //cout << "len = " << len << " L = " << L << " L2 = " << L2 << endl;

    double sub = L * L2;

    double area = ( V * len * len ) / ( 4 * tan( M_PI / V ) );

    //cout << "area = " << area << " sub = " << sub << endl;
    //cout << sub * V << endl;

    cout << setiosflags(ios::fixed) << setprecision(7) << area - sub * V << endl;


  }
  return 0;
}

Measured memory_bytes: 1320