#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}
P unit(const P &p){
    return p/abs(p);
}
P rotate(const P &p, double rad){
    return p *P(cos(rad), sin(rad));
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}

P projection(const L& l, const P& p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
double distanceLP(const L &l, const P &p) {
    return abs(cross(l[1]-l[0], p-l[0])) /abs(l[1]-l[0]);
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}

VP crosspointCC(C a, C b){
    VP ret;
    if(a.p == b.p && a.r == b.r){
        return ret;
    }
    if(a.r < b.r) swap(a,b);
    double dist = abs(b.p-a.p);
    P dir = a.r*unit(b.p-a.p);
    if(EQ(dist, a.r+b.r) || EQ(dist, a.r-b.r)){
        ret.push_back(a.p +dir);
    }else if(a.r-b.r < dist && dist < a.r+b.r){
        double cos = (a.r*a.r +dist*dist -b.r*b.r)/(2*a.r*dist);
        double sin = sqrt(1 -cos*cos);
        ret.push_back(a.p +dir*P(cos, sin));
        ret.push_back(a.p +dir*P(cos, -sin));
    }
    return ret;
}

bool isValid(const P &p){
	return -100 < p.X +EPS && p.X < 100 +EPS &&
		-100 < p.Y +EPS && p.Y < 100 +EPS &&
		EQ(p.X, round(p.X)) && EQ(p.Y, round(p.Y));			
}

double solve(const VP &tri, const P &p, const P &q){
	//p,qを置く位置が不正
	if(!isValid(p) || !isValid(q)) return INF;
	if(cross(tri[0] -tri[1], p -tri[1]) < EPS) return INF*2;
	if(cross(tri[2] -tri[0], q -tri[0]) < EPS) return INF*3;
	if(intersectSS(L(tri[1], p), L(tri[0], q))) return INF*4;
	if(intersectSS(L(tri[0], p), L(tri[2], q))) return INF*5;

	//もう1つの点rの位置
	VP cp = crosspointCC(C(tri[1], abs(tri[1] -p)), C(tri[2], abs(tri[2] -q)));
	if((int)cp.size()!=2) return INF;
	P r = (cross(tri[1] -tri[2], cp[0] -tri[2]) > EPS)? cp[0]: cp[1];
	if(!isValid(r)) return INF;

	//四面体の高さを計算
	P cpll = crosspointLL(L(p, projection(L(tri[0], tri[1]), p)), 
		L(q, projection(L(tri[2], tri[0]), q)));
	double d = distanceLP(L(tri[0], tri[1]), p);
	double a = distanceLP(L(tri[0], tri[1]), cpll);
    if(EQ(d, a)) return INF;
	return sqrt(d*d -a*a);
}

int main(){
	vector<VP> ltoxy(80001);
	for(int x=0; x<=200; x++){
		for(int y=0; y<=200; y++){
			int lsq = x*x +y*y;
			ltoxy[lsq].emplace_back(x, y);
            if(x != 0){
                ltoxy[lsq].emplace_back(-x, y);
            }
			if(y != 0){
                ltoxy[lsq].emplace_back(x, -y);
            }
			if(x != 0 && y != 0){
                ltoxy[lsq].emplace_back(-x, -y);
            }
		}
	}

    while(1){
    	VP tri(3);
    	P ori(0, 0);
    	for(int i=0; i<3; i++){
    		int x,y;
    		cin >> x >> y;
    		tri[i] = P(x, y);
    	}
    	if(tri[0]==ori && tri[1]==ori && tri[2]==ori){
    		break;
    	}

    	double ans = INF;
    	for(int l=1; l<(int)ltoxy.size(); l++){
    		for(const P &p: ltoxy[l]){
    			for(const P &q: ltoxy[l]){
    				ans = min(ans, solve(tri, tri[0]+p, tri[0]+q));
    			}
    		}
    	}
    	if(ans == INF){
    		cout << -1 << endl;
    	}else{
	    	cout << fixed << setprecision(10);
    		cout << ans << endl;
    	}
    }
    return 0;
}

### Prompt

Generate a Cpp solution to the following problem:

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 <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
struct C{
    P p;
    double r;
    C(const P& p, const double& r) : p(p), r(r) {}
    C(){}
};

namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}
P unit(const P &p){
    return p/abs(p);
}
P rotate(const P &p, double rad){
    return p *P(cos(rad), sin(rad));
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}

P projection(const L& l, const P& p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
double distanceLP(const L &l, const P &p) {
    return abs(cross(l[1]-l[0], p-l[0])) /abs(l[1]-l[0]);
}

P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}

VP crosspointCC(C a, C b){
    VP ret;
    if(a.p == b.p && a.r == b.r){
        return ret;
    }
    if(a.r < b.r) swap(a,b);
    double dist = abs(b.p-a.p);
    P dir = a.r*unit(b.p-a.p);
    if(EQ(dist, a.r+b.r) || EQ(dist, a.r-b.r)){
        ret.push_back(a.p +dir);
    }else if(a.r-b.r < dist && dist < a.r+b.r){
        double cos = (a.r*a.r +dist*dist -b.r*b.r)/(2*a.r*dist);
        double sin = sqrt(1 -cos*cos);
        ret.push_back(a.p +dir*P(cos, sin));
        ret.push_back(a.p +dir*P(cos, -sin));
    }
    return ret;
}

bool isValid(const P &p){
	return -100 < p.X +EPS && p.X < 100 +EPS &&
		-100 < p.Y +EPS && p.Y < 100 +EPS &&
		EQ(p.X, round(p.X)) && EQ(p.Y, round(p.Y));			
}

double solve(const VP &tri, const P &p, const P &q){
	//p,qを置く位置が不正
	if(!isValid(p) || !isValid(q)) return INF;
	if(cross(tri[0] -tri[1], p -tri[1]) < EPS) return INF*2;
	if(cross(tri[2] -tri[0], q -tri[0]) < EPS) return INF*3;
	if(intersectSS(L(tri[1], p), L(tri[0], q))) return INF*4;
	if(intersectSS(L(tri[0], p), L(tri[2], q))) return INF*5;

	//もう1つの点rの位置
	VP cp = crosspointCC(C(tri[1], abs(tri[1] -p)), C(tri[2], abs(tri[2] -q)));
	if((int)cp.size()!=2) return INF;
	P r = (cross(tri[1] -tri[2], cp[0] -tri[2]) > EPS)? cp[0]: cp[1];
	if(!isValid(r)) return INF;

	//四面体の高さを計算
	P cpll = crosspointLL(L(p, projection(L(tri[0], tri[1]), p)), 
		L(q, projection(L(tri[2], tri[0]), q)));
	double d = distanceLP(L(tri[0], tri[1]), p);
	double a = distanceLP(L(tri[0], tri[1]), cpll);
    if(EQ(d, a)) return INF;
	return sqrt(d*d -a*a);
}

int main(){
	vector<VP> ltoxy(80001);
	for(int x=0; x<=200; x++){
		for(int y=0; y<=200; y++){
			int lsq = x*x +y*y;
			ltoxy[lsq].emplace_back(x, y);
            if(x != 0){
                ltoxy[lsq].emplace_back(-x, y);
            }
			if(y != 0){
                ltoxy[lsq].emplace_back(x, -y);
            }
			if(x != 0 && y != 0){
                ltoxy[lsq].emplace_back(-x, -y);
            }
		}
	}

    while(1){
    	VP tri(3);
    	P ori(0, 0);
    	for(int i=0; i<3; i++){
    		int x,y;
    		cin >> x >> y;
    		tri[i] = P(x, y);
    	}
    	if(tri[0]==ori && tri[1]==ori && tri[2]==ori){
    		break;
    	}

    	double ans = INF;
    	for(int l=1; l<(int)ltoxy.size(); l++){
    		for(const P &p: ltoxy[l]){
    			for(const P &q: ltoxy[l]){
    				ans = min(ans, solve(tri, tri[0]+p, tri[0]+q));
    			}
    		}
    	}
    	if(ans == INF){
    		cout << -1 << endl;
    	}else{
	    	cout << fixed << setprecision(10);
    		cout << ans << endl;
    	}
    }
    return 0;
}

```