Problem: Problem D: Exportation in Space

In an era of space travelling, Mr. Jonathan A. Goldmine exports a special material named "Interstellar Condensed Powered Copper". A piece of it consists of several spheres floating in the air. There is strange force affecting between the spheres so that their relative positions of them are not changed. If you move one of them, all the others follow it.

<image>
Example of ICPC (left: bare, right: shielded)

To transport ICPCs between planets, it needs to be shielded from cosmic rays. It will be broken when they hit by strong cosmic rays. Mr. Goldmine needs to wrap up each ICPC pieces with anti-cosmic-ray shield, a paper-like material which cuts all the cosmic rays. To save cost, he wants to know the minimum area of the shield he needs to wrap an ICPC piece up.

Note that he can't put the shield between the spheres of an ICPC because it affects the force between the spheres. So that the only way to shield it is to wrap the whole ICPC piece by shield.

Mr. Goldmine asked you, an experienced programmer, to calculate the minimum area of shield for each material.

You can assume that each sphere in an ICPC piece is a point, and you can ignore the thickness of the shield.



Input

Each file consists of one test case, which has the information of one ICPC piece. A test case starts with a line with an integer N (4 <= N <= 50), denoting the number of spheres in the piece of the test case. Then N lines follow. The i-th line of them describes the position of the i-th sphere. It has 3 integers xi, yi and zi (0 <= x, y, z <= 100), separated by a space. They denote the x, y and z coordinates of the i-th sphere, respectively.

It is guaranteed that there are no data all of whose spheres are on the same plane, and that no two spheres in a data are on the same coordinate.

Output

For each input, print the area of the shield Mr. Goldmine needs. The output value should be in a decimal fraction and should not contain an error greater than 0.001.

Examples

Input

4
0 0 0
0 0 1
0 1 0
1 0 0


Output

2.366


Input

8
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1


Output

6.000

Solution (in CPP):

Solution:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
#define PR 1e-8
#define N 310
struct TPoint
{
	double x,y,z;
	TPoint(){}
	TPoint(double _x,double _y,double _z):x(_x),y(_y),z(_z){}
	TPoint operator-(const TPoint p) {return TPoint(x-p.x,y-p.y,z-p.z);}
	TPoint operator*(const TPoint p) {return TPoint(y*p.z-z*p.y,z*p.x-x*p.z,x*p.y-y*p.x);}//????§?
	double operator^(const TPoint p) {return x*p.x+y*p.y+z*p.z;}//????§?
};
struct fac//
{
	int a,b,c;//??????????????¢????????????????????????
	bool ok;//??\??¢?????????????????????????????¢
};
struct T3dhull
{
	int n;//????§??????°
	TPoint ply[N];//????§????
	int trianglecnt;//?????????????§???¢??°
	fac tri[N];//??????????§???¢
	int vis[N][N];//???i??°???j????±????????????¢
	double dist(TPoint a){return sqrt(a.x*a.x+a.y*a.y+a.z*a.z);}//????????????
	double area(TPoint a,TPoint b,TPoint c){return dist((b-a)*(c-a));}//????§???¢??¢?§?*2
	double volume(TPoint a,TPoint b,TPoint c,TPoint d){return (b-a)*(c-a)^(d-a);}//?????¢?????????????§?*6
	double ptoplane(TPoint &p,fac &f)//??£????????¨??¢??????
	{
		TPoint m=ply[f.b]-ply[f.a],n=ply[f.c]-ply[f.a],t=p-ply[f.a];
		return (m*n)^t;
	}
	void deal(int p,int a,int b)
	{
		int f=vis[a][b];//???????????¢(cnt)??±???(ab)?????£?????¢
		fac add;
		if(tri[f].ok)
		{
			if((ptoplane(ply[p],tri[f]))>PR) dfs(p,f);//??????p???????????°??\??¢f????????§?????±?????¢?´¢f???3???????????\?????´??°??°???????????¢
			else//????????????p???????????°cnt??¢???????????°f??¢??????p??????a???b???????????????????§???¢???
			{
				add.a=b,add.b=a,add.c=p,add.ok=1;
				vis[p][b]=vis[a][p]=vis[b][a]=trianglecnt;
				tri[trianglecnt++]=add;
			}
		}
	}
	void dfs(int p,int cnt)//??´?????????????????????p??¨???????????´??°??????
	{
		tri[cnt].ok=0;//????????¢??????????????????????????¨??´??§??????????????¢

		//?????¢??????????????\(???b,???a)?????\?????¨deal()????????????????????¢(cnt)??±???(ab)?????£?????¢????????????????????´??¢(cnt)?????????3?????¢(?????¬???????????¢?????±??????????????????????????????(1)???????????????(????????¶???)?????¢130???312,?????¬??±???13?????????????????????13,??????????????????31)       

		deal(p,tri[cnt].b,tri[cnt].a);
		deal(p,tri[cnt].c,tri[cnt].b);
		deal(p,tri[cnt].a,tri[cnt].c);
	}
	bool same(int s,int e)//??????????????¢?????????????????¢
	{
		TPoint a=ply[tri[s].a],b=ply[tri[s].b],c=ply[tri[s].c];
		return fabs(volume(a,b,c,ply[tri[e].a]))<PR
			&&fabs(volume(a,b,c,ply[tri[e].b]))<PR
			&&fabs(volume(a,b,c,ply[tri[e].c]))<PR;
	}
	void construct()//????????????
	{
		int i,j;
		trianglecnt=0;
		if(n<4) return ;
		bool tmp=true;
		for(i=1;i<n;i++)//??????????????±???
		{
			if((dist(ply[0]-ply[i]))>PR)
			{
				swap(ply[1],ply[i]); tmp=false; break;
			}
		}
		if(tmp) return;
		tmp=true;
		for(i=2;i<n;i++)//??????????????±???
		{
			if((dist((ply[0]-ply[1])*(ply[1]-ply[i])))>PR)
			{
				swap(ply[2],ply[i]); tmp=false; break;
			}
		}
		if(tmp) return ;
		tmp=true;
		for(i=3;i<n;i++)//??????????????±??¢
		{
			if(fabs((ply[0]-ply[1])*(ply[1]-ply[2])^(ply[0]-ply[i]))>PR)
			{
				swap(ply[3],ply[i]); tmp=false; break;
			}
		}
		if(tmp) return ;
		fac add;
		for(i=0;i<4;i++)//??????????§??????¢???(4?????????ply[0],ply[1],ply[2],ply[3])
		{
			add.a=(i+1)%4,add.b=(i+2)%4,add.c=(i+3)%4,add.ok=1;
			if((ptoplane(ply[i],add))>0) swap(add.b,add.c);//???????????¶???????????????????????????????????°??????????????°???
			vis[add.a][add.b]=vis[add.b][add.c]=vis[add.c][add.a]=trianglecnt;//????????????????????????
			tri[trianglecnt++]=add;
		}
		for(i=4;i<n;i++)//????????´??°??????
		{
			for(j=0;j<trianglecnt;j++)//??????????????????????????¨??????3??´???????????????(i??¨????????????,j??¨???????????¢)
			{
				if(tri[j].ok&&(ptoplane(ply[i],tri[j]))>PR)//?????????????????¢??????????????????????????????????????°????????¢
				{
					dfs(i,j); break;//???????????°????????¢?????´??°???????????¢(????????????????????¢??´??°????????¢)??????????????´??°?????????break????????????

				}
			}
		}
		int cnt=trianglecnt;//????????¢????????????tri[i].ok=0????????¬?±????????§???????????????\????????¨??´??§????????????????????????????????\?????¢????????£???????????¨???????????????????±??????????
		trianglecnt=0;
		for(i=0;i<cnt;i++)
		{
			if(tri[i].ok)
				tri[trianglecnt++]=tri[i];
		}
	}
	double area()//??¨??¢?§?
	{
		double ret=0;
		for(int i=0;i<trianglecnt;i++)
			ret+=area(ply[tri[i].a],ply[tri[i].b],ply[tri[i].c]);
		return ret/2;
	}
	double volume()//????§?
	{
		TPoint p(0,0,0);
		double ret=0;
		for(int i=0;i<trianglecnt;i++)
			ret+=volume(p,ply[tri[i].a],ply[tri[i].b],ply[tri[i].c]);
		return fabs(ret/6);
	}
	int facetri() {return trianglecnt;}//??¨??¢????§???¢??°
	int facepolygon()//??¨??¢????????¢??°
	{
		int ans=0,i,j,k;
		for(i=0;i<trianglecnt;i++)
		{
			for(j=0,k=1;j<i;j++)
			{
				if(same(i,j)) {k=0;break;}
			}
			ans+=k;
		}
		return ans;
	}

}hull;
int main()
{
	while(~scanf("%d",&hull.n))
	{
		int i;
		for(i=0;i<hull.n;i++)
			scanf("%lf%lf%lf",&hull.ply[i].x,&hull.ply[i].y,&hull.ply[i].z);
		hull.construct();
		printf("%.3f\n",hull.area());
	}
	return 0;
}