#include<cstdio>
#include<vector>
#include<utility>
#include<complex>
#include<cmath>
#include<algorithm>

using namespace std;

typedef double Real;
typedef pair<int,int> P;

vector<P> dirs[200*200*2+1];

int crP(int x1,int y1,int x2,int y2){
	return x1*y2-x2*y1;
}

void init_dir(){
	for(int x=-200;x<=200;x++) for(int y=-200;y<=200;y++){
		dirs[x*x+y*y].push_back(P(x,y));
	}
}

Real getHeight(Real a,Real b,Real c){
	Real y=(a + (b*b-c*c)/a)/2;
	return sqrt(b*b-y*y);
}

Real getH2(Real a,Real b,Real c){
	Real y = (a + (b*b-c*c)/a)/2;
	return a-y;
}

const Real eps = 1e-8;

int cnt=0;
Real getHeight(Real a,Real b,Real c,Real d,Real e,Real f){
//	printf("%f %f %f %f %f %f\n",a,b,c,d,e,f);
	Real h_=getHeight(a,d,f);
	Real x=getH2(a,d,f);
	Real h2=getHeight(a,b,c);
	Real y=getH2(a,b,c);
	Real p=y-x;
	Real q=h2-h_;
	Real val = -(e*e - h_*h_ - (h_+q)*(h_+q) - p*p) / (2.0 * (h_+q) * h_);
	if(abs(val) >= 1.0 - eps) return -1;
//	printf("%f %f %f %f %f %f %f %f\n",h_,x,h2,y,p,q,val,h_*sqrt(1-val*val));
//	if(++cnt>10) exit(0);
	return h_ * sqrt(1-val*val);
}

bool sameSide(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4){
	int p3 = crP(x2-x1,y2-y1,x3-x2,y3-y2);
	int p4 = crP(x2-x1,y2-y1,x4-x2,y4-y2);
	return p3*p4>=0;
}

int dis2(int x1,int y1,int x2,int y2){
	return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}

Real dis(int x1,int y1,int x2,int y2){
	return sqrt(dis2(x1,y1,x2,y2));
}

bool check(int x){
	return x>=-100&&x<=100;
}

Real solve(int x1,int y1,int x2,int y2,int x3,int y3){
	Real a=dis(x1,y1,x2,y2);
	Real b=dis(x2,y2,x3,y3);
	Real c=dis(x3,y3,x1,y1);
	Real res = -1;
	for(int x4=-100;x4<=100;x4++) for(int y4=-100;y4<=100;y4++){
		if(sameSide(x1,y1,x2,y2,x3,y3,x4,y4)) continue;
		int d2=dis2(x2,y2,x4,y4);
		Real d=sqrt(d2);
		int f2=dis2(x1,y1,x4,y4);
		Real f=sqrt(f2);
		for(int i = 0; i < dirs[d2].size(); i++){
			for(int j = 0; j < dirs[f2].size(); j++){
				int x5 = x2 + dirs[d2][i].first;
				int y5 = y2 + dirs[d2][i].second;
				int x6 = x1 + dirs[f2][j].first;
				int y6 = y1 + dirs[f2][j].second;
				if((!check(x5)) || (!check(y5)) || (!check(x6)) || (!check(y6))) continue;
				if(sameSide(x2,y2,x3,y3,x1,y1,x5,y5)) continue;
				if(sameSide(x3,y3,x1,y1,x2,y2,x6,y6)) continue;
				int e2 = dis2(x3,y3,x6,y6);
				if(e2 != dis2(x3,y3,x5,y5)) continue;
				Real e = sqrt(e2);
				Real h = getHeight(a,b,c,d,e,f);
				if(h > 0 && (res < 0 || res > h)) res = h;
	//			if(d2==5&&e2==5) printf("%d %d %d %f\n",d2,e2,f2,h);
			}
		}
	}
	return res;
}

int main(){
	init_dir();
	while(true){
		int x1,y1,x2,y2,x3,y3;
		scanf("%d%d%d%d%d%d2",&x1,&y1,&x2,&y2,&x3,&y3);
		if(x1==0&&y1==0&&x2==0&&y2==0&&x3==0&&y3==0) break;
		Real ans = solve(x1,y1,x2,y2,x3,y3);
		if(ans < 0) printf("-1\n");
		else printf("%.9f\n",ans);
//		break;
	}
	return 0;
}
### Prompt

Construct a Cpp code solution to the problem outlined:

You are constructing a triangular pyramid with a sheet of craft paper with grid lines. Its base and sides are all of triangular shape. You draw the base triangle and the three sides connected to the base on the paper, cut along the outer six edges, fold the edges of the base, and assemble them up as a pyramid.

You are given the coordinates of the base's three vertices, and are to determine the coordinates of the other three. All the vertices must have integral X- and Y-coordinate values between -100 and +100 inclusive. Your goal is to minimize the height of the pyramid satisfying these conditions. Figure 3 shows some examples.

<image>

Figure 3: Some craft paper drawings and side views of the assembled pyramids



Input

The input consists of multiple datasets, each in the following format.

X0 Y0 X1 Y1 X2 Y2

They are all integral numbers between -100 and +100 inclusive. (X0, Y0), (X1, Y1), (X2, Y2) are the coordinates of three vertices of the triangular base in counterclockwise order.

The end of the input is indicated by a line containing six zeros separated by a single space.

Output

For each dataset, answer a single number in a separate line. If you can choose three vertices (Xa, Ya), (Xb, Yb) and (Xc, Yc) whose coordinates are all integral values between -100 and +100 inclusive, and triangles (X0, Y0 )-(X1, Y1)-(Xa, Ya), (X1, Y1)-(X2, Y2)-(Xb, Yb), (X2, Y2)-(X0, Y0)-(Xc, Yc) and (X0, Y0)-(X1, Y1)-(X2, Y2) do not overlap each other (in the XY-plane), and can be assembled as a triangular pyramid of positive (non-zero) height, output the minimum height among such pyramids. Otherwise, output -1.

You may assume that the height is, if positive (non-zero), not less than 0.00001. The output should not contain an error greater than 0.00001.

Example

Input

0 0 1 0 0 1
0 0 5 0 2 5
-100 -100 100 -100 0 100
-72 -72 72 -72 0 72
0 0 0 0 0 0


Output

2
1.49666
-1
8.52936

### Response

```cpp
#include<cstdio>
#include<vector>
#include<utility>
#include<complex>
#include<cmath>
#include<algorithm>

using namespace std;

typedef double Real;
typedef pair<int,int> P;

vector<P> dirs[200*200*2+1];

int crP(int x1,int y1,int x2,int y2){
	return x1*y2-x2*y1;
}

void init_dir(){
	for(int x=-200;x<=200;x++) for(int y=-200;y<=200;y++){
		dirs[x*x+y*y].push_back(P(x,y));
	}
}

Real getHeight(Real a,Real b,Real c){
	Real y=(a + (b*b-c*c)/a)/2;
	return sqrt(b*b-y*y);
}

Real getH2(Real a,Real b,Real c){
	Real y = (a + (b*b-c*c)/a)/2;
	return a-y;
}

const Real eps = 1e-8;

int cnt=0;
Real getHeight(Real a,Real b,Real c,Real d,Real e,Real f){
//	printf("%f %f %f %f %f %f\n",a,b,c,d,e,f);
	Real h_=getHeight(a,d,f);
	Real x=getH2(a,d,f);
	Real h2=getHeight(a,b,c);
	Real y=getH2(a,b,c);
	Real p=y-x;
	Real q=h2-h_;
	Real val = -(e*e - h_*h_ - (h_+q)*(h_+q) - p*p) / (2.0 * (h_+q) * h_);
	if(abs(val) >= 1.0 - eps) return -1;
//	printf("%f %f %f %f %f %f %f %f\n",h_,x,h2,y,p,q,val,h_*sqrt(1-val*val));
//	if(++cnt>10) exit(0);
	return h_ * sqrt(1-val*val);
}

bool sameSide(int x1,int y1,int x2,int y2,int x3,int y3,int x4,int y4){
	int p3 = crP(x2-x1,y2-y1,x3-x2,y3-y2);
	int p4 = crP(x2-x1,y2-y1,x4-x2,y4-y2);
	return p3*p4>=0;
}

int dis2(int x1,int y1,int x2,int y2){
	return (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
}

Real dis(int x1,int y1,int x2,int y2){
	return sqrt(dis2(x1,y1,x2,y2));
}

bool check(int x){
	return x>=-100&&x<=100;
}

Real solve(int x1,int y1,int x2,int y2,int x3,int y3){
	Real a=dis(x1,y1,x2,y2);
	Real b=dis(x2,y2,x3,y3);
	Real c=dis(x3,y3,x1,y1);
	Real res = -1;
	for(int x4=-100;x4<=100;x4++) for(int y4=-100;y4<=100;y4++){
		if(sameSide(x1,y1,x2,y2,x3,y3,x4,y4)) continue;
		int d2=dis2(x2,y2,x4,y4);
		Real d=sqrt(d2);
		int f2=dis2(x1,y1,x4,y4);
		Real f=sqrt(f2);
		for(int i = 0; i < dirs[d2].size(); i++){
			for(int j = 0; j < dirs[f2].size(); j++){
				int x5 = x2 + dirs[d2][i].first;
				int y5 = y2 + dirs[d2][i].second;
				int x6 = x1 + dirs[f2][j].first;
				int y6 = y1 + dirs[f2][j].second;
				if((!check(x5)) || (!check(y5)) || (!check(x6)) || (!check(y6))) continue;
				if(sameSide(x2,y2,x3,y3,x1,y1,x5,y5)) continue;
				if(sameSide(x3,y3,x1,y1,x2,y2,x6,y6)) continue;
				int e2 = dis2(x3,y3,x6,y6);
				if(e2 != dis2(x3,y3,x5,y5)) continue;
				Real e = sqrt(e2);
				Real h = getHeight(a,b,c,d,e,f);
				if(h > 0 && (res < 0 || res > h)) res = h;
	//			if(d2==5&&e2==5) printf("%d %d %d %f\n",d2,e2,f2,h);
			}
		}
	}
	return res;
}

int main(){
	init_dir();
	while(true){
		int x1,y1,x2,y2,x3,y3;
		scanf("%d%d%d%d%d%d2",&x1,&y1,&x2,&y2,&x3,&y3);
		if(x1==0&&y1==0&&x2==0&&y2==0&&x3==0&&y3==0) break;
		Real ans = solve(x1,y1,x2,y2,x3,y3);
		if(ans < 0) printf("-1\n");
		else printf("%.9f\n",ans);
//		break;
	}
	return 0;
}
```