Problem: There is a flat island whose shape is a perfect square. On this island, there are three habitants whose names are IC, PC, and ACM Every day, one jewel is dropped from the heaven. Just as the jewel touches the ground, IC, PC, and ACM leave their houses simultaneously, run with the same speed, and then a person who first touched the jewel can get the jewel. Hence, the person whose house is nearest to the location of the jewel is the winner of that day.

They always have a quarrel with each other, and therefore their houses are located at distinct places. The locations of their houses are fixed. This jewel falls at a random point on the island, that is, all points on the island have even chance.

When three are two or more persons whose houses are simultaneously nearest, the last person in the order of

IC, PC, ACM

obtains the jewel.

Our interest is to know the probability for IC to get the jewel under this situation.



Input

The input describes one problem instance per line. Each line contains the x- and y-coordinates of IC's home, those of PC's, and those of ACM's in this order. Note that the houses of IC, PC and ACM are located at distinct places. The end of the input is indicated by a line with six zeros.

The coordinates of the whole island are given by (0, 10000) × (0, 10000) and coordinates of houses are given in integer numbers between 1 and 9999, inclusive. It should be noted that the locations of the jewels are arbitrary places on the island and their coordinate values are not necessarily integers.

Output

For each input line, your program should output its sequence number starting from 1, and the probability for the instance. The computed probability values should have errors less than 10-5.

The sequence number and the probability should be printed on the same line. The two numbers should be separated by a space.

Example

Input

2000 2000 8000 8000 9000 9500
2500 2500 7500 2500 2500 7500
0 0 0 0 0 0


Output

1 0.50000
2 0.25000

Solution (in CPP):

Solution:
#include <iostream>
#include <cstdio>
#include <complex>
#include <vector>
#include <cassert>
#include <iomanip>
#include <algorithm>
using namespace std;

#define EPS 1e-8
typedef complex<double> P;
typedef vector<P> G;

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

bool intersectLS(const L &l, const L &s) {
  return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
         cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}

P crosspoint(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]);
  if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return m[0] + B / A * (m[1] - m[0]);
}

int ccw(P a, P b, P c)
{
	b -= a; c -= a;
	if (cross(b, c) > +EPS) return +1;
	if (cross(b, c) < -EPS) return -1;
	if (dot(b, c)   < -EPS) return +2;
	if (norm(b) < norm(c))  return -2;
	return 0;
}

bool notleft(P a, P b, P c)
{
	return (ccw(a,b,c)!=+1);
}

bool isIntoG(const G& g, const P& p)
{
	size_t sz = g.size();
	for(size_t i=0; i<sz; i++)
	{
		if( notleft(p, g[i], g[(i+1)%sz]) ) return false;
	}
	return true;
}

bool isfar(G& g, P& p)
{
	for(int i=0; i<g.size(); i++)
		if(abs(g[i]-p) < EPS) return false;
		
	return true;
}

#define CURR(P, i) P[i]
#define NEXT(P, i) P[(i+1)%P.size()]

bool ConvexCut(G& g, L& l, vector<G>& ret)
{
	int sp,inp=0;
	for(sp=0; sp<g.size(); sp++)
		if(intersectLS(l, L(g[sp], g[(sp+1)%g.size()]))) break;
		
	if(sp==g.size()) return false;
	
	ret.resize(2);
		
	P xp=crosspoint(l, L(g[sp], g[(sp+1)%g.size()]));
	sp++;
	
	for(int i=sp; i<sp+g.size(); i++)
	{
		if(isfar(ret[inp], g[i%g.size()])) ret[inp].push_back(g[i%g.size()]);
		if(intersectLS(l, L(g[i%g.size()], g[(i+1)%g.size()])))
		{
			P tx=crosspoint(l, L(g[i%g.size()], g[(i+1)%g.size()]));
			if(abs(tx-xp) < EPS) continue;
			
			xp=tx;
			for(int j=0; j<2; j++)
			{
				if(isfar(ret[j], xp)) ret[j].push_back(xp);
			}
			
			inp=(inp+1)%2;
		}
	}
	
	return true;
}

L trans(P a, P b)
{
	P med=(a+b);
	med=P(med.real()/2, med.imag()/2);
	P hoge=(a-b);
	hoge*=P(0,1);
	
	return L(med+hoge*P(100000,0), med-hoge*P(100000,0));
}

double Area(G& g)
{
	double ret=0;
	for(int i=0; i<g.size(); i++)
		ret+=cross(CURR(g,i), NEXT(g,i))/2;
		
	return ret;
}

int main()
{
	int T=1;
	while(1) {
		int p[6];
		bool end = true;
		for(int i=0; i<6; i++) {
			cin >> p[i];
			if(p[i]!=0) end = false;
		}

		if(end) break;

		G g,pts;
		vector<L> line;
		g.push_back(P(0,0));
		g.push_back(P(10000, 0));
		g.push_back(P(10000, 10000));
		g.push_back(P(0, 10000));

		for(int i=0; i<3; i++) 
			pts.push_back(P(p[2*i], p[2*i+1]));

		line.push_back(trans(pts[0], pts[1]));
		line.push_back(trans(pts[0], pts[2]));
		
		G f=g;
		for(int i=0; i<2; i++){
			vector<G> cut;
			if(!ConvexCut(f, line[i], cut)) continue;
			if(isIntoG(cut[0], pts[0])) f=cut[0];
			else f=cut[1];	
		}
		
		printf("%d %.5lf\n", T++, Area(f)/Area(g));
	}
}