Problem: A mobile phone company ACMICPC (Advanced Cellular, Mobile, and Internet-Connected Phone Corporation) is planning to set up a collection of antennas for mobile phones in a city called Maxnorm. The company ACMICPC has several collections for locations of antennas as their candidate plans, and now they want to know which collection is the best choice.

for this purpose, they want to develop a computer program to find the coverage of a collection of antenna locations. Each antenna Ai has power ri, corresponding to "radius". Usually, the coverage region of the antenna may be modeled as a disk centered at the location of the antenna (xi, yi) with radius ri. However, in this city Maxnorm such a coverage region becomes the square [xi − ri, xi + ri] × [yi − ri, yi + ri]. In other words, the distance between two points (xp, yp) and (xq, yq) is measured by the max norm max{ |xp − xq|, |yp − yq|}, or, the L∞ norm, in this city Maxnorm instead of the ordinary Euclidean norm √ {(xp − xq)2 + (yp − yq)2}.

As an example, consider the following collection of 3 antennas


4.0 4.0 3.0
5.0 6.0 3.0
5.5 4.5 1.0


depicted in the following figure

<image>

where the i-th row represents xi, yi ri such that (xi, yi) is the position of the i-th antenna and ri is its power. The area of regions of points covered by at least one antenna is 52.00 in this case.

Write a program that finds the area of coverage by a given collection of antenna locations.



Input

The input contains multiple data sets, each representing a collection of antenna locations. A data set is given in the following format.



n
x1 y1 r1
x2 y2 r2
. . .
xn yn rn



The first integer n is the number of antennas, such that 2 ≤ n ≤ 100. The coordinate of the i-th antenna is given by (xi, yi), and its power is ri. xi, yi and ri are fractional numbers between 0 and 200 inclusive.

The end of the input is indicated by a data set with 0 as the value of n.

Output

For each data set, your program should output its sequence number (1 for the first data set, 2 for the second, etc.) and the area of the coverage region. The area should be printed with two digits to the right of the decimal point, after rounding it to two decimal places.

The sequence number and the area should be printed on the same line with no spaces at the beginning and end of the line. The two numbers should be separated by a space.

Example

Input

3
4.0 4.0 3.0
5.0 6.0 3.0
5.5 4.5 1.0
2
3.0 3.0 3.0
1.5 1.5 1.0
0


Output

1 52.00
2 36.00

Solution (in JAVA):

Solution:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	int n;
	R[] rs;
	int caze;

	void run(){
		for(caze=1;; caze++){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			rs=new R[n];
			for(int i=0; i<n; i++){
				double x=sc.nextDouble();
				double y=sc.nextDouble();
				double r=sc.nextDouble();
				rs[i]=new R(x-r, y-r, x+r, y+r);
			}
			solve();
			// debug(solveX(), solveY());
		}
	}

	void solve(){
		TreeSet<Double> setX=new TreeSet<Double>();
		for(int i=0; i<n; i++){
			setX.add(rs[i].x1);
			setX.add(rs[i].x2);
		}
		Double[] xs=setX.toArray(new Double[0]);
		sort(xs);
		int m=xs.length;
		@SuppressWarnings("unchecked")
		TreeSet<R>[] setR=new TreeSet[m];
		for(int i=0; i<m; i++){
			setR[i]=new TreeSet<R>();
		}

		for(int j=0; j<m-1; j++){
			for(int i=0; i<n; i++){
				if(rs[i].x1<xs[j]+EPS&&xs[j]+EPS<rs[i].x2){
					setR[j].add(rs[i]);
				}
			}
		}

		double sum=0;
		for(int k=0; k<m-1; k++){
			LinkedList<Double> seg=new LinkedList<Double>();
			for(R r : setR[k]){
				if(abs(r.y1-r.y2)<EPS){
					continue;
				}
				int i=seg.size(), j=seg.size();
				for(int p=seg.size()-1; p>=0; p--){
					double y=seg.get(p);
					if(y+EPS>r.y2){
						j=p;
					}
					if(y+EPS>r.y1){
						i=p;
					}
				}
				for(int p=i; p<j; p++){
					seg.remove(i);
				}
				if(j%2==0){
					seg.add(i, r.y2);
				}
				if(i%2==0){
					seg.add(i, r.y1);
				}
			}
			double len=0;
			for(int i=0; i<seg.size(); i+=2){
				len+=seg.get(i+1)-seg.get(i);
			}
			sum+=len*(xs[k+1]-xs[k]);
		}
		debug(sum);
		println(String.format("%d %.2f", caze, sum+EPS));
	}

	double solveX(){
		TreeSet<Double> setX=new TreeSet<Double>();
		for(int i=0; i<n; i++){
			setX.add(rs[i].x1);
			setX.add(rs[i].x2);
		}
		Double[] xs=setX.toArray(new Double[0]);
		sort(xs);
		int m=xs.length;
		@SuppressWarnings("unchecked")
		TreeSet<R>[] setR=new TreeSet[m];
		for(int i=0; i<m; i++){
			setR[i]=new TreeSet<R>();
		}

		for(int j=0; j<m-1; j++){
			for(int i=0; i<n; i++){
				if(rs[i].x1<xs[j]+EPS&&xs[j]+EPS<rs[i].x2){
					setR[j].add(rs[i]);
				}
			}
		}

		double sum=0;
		for(int k=0; k<m-1; k++){
			LinkedList<Double> seg=new LinkedList<Double>();
			for(R r : setR[k]){
				if(abs(r.y1-r.y2)<EPS){
					continue;
				}
				int i=seg.size(), j=seg.size();
				for(int p=seg.size()-1; p>=0; p--){
					double y=seg.get(p);
					if(y+EPS>r.y2){
						j=p;
					}
					if(y+EPS>r.y1){
						i=p;
					}
				}
				for(int p=i; p<j; p++){
					seg.remove(i);
				}
				if(j%2==0){
					seg.add(i, r.y2);
				}
				if(i%2==0){
					seg.add(i, r.y1);
				}
			}
			double len=0;
			for(int i=0; i<seg.size(); i+=2){
				len=seg.get(i+1)-seg.get(i);
			}
			sum+=len*(xs[k+1]-xs[k]);
		}
		// println(String.format("%d %.2f", caze, sum+EPS));
		return sum;
	}

	double solveY(){
		TreeSet<Double> setY=new TreeSet<Double>();
		for(int i=0; i<n; i++){
			setY.add(rs[i].y1);
			setY.add(rs[i].y2);
		}
		Double[] ys=setY.toArray(new Double[0]);
		sort(ys);
		int m=ys.length;
		@SuppressWarnings("unchecked")
		TreeSet<R>[] setR=new TreeSet[m];
		for(int i=0; i<m; i++){
			setR[i]=new TreeSet<R>();
		}

		for(int j=0; j<m-1; j++){
			for(int i=0; i<n; i++){
				if(rs[i].y1<ys[j]+EPS&&ys[j]+EPS<rs[i].y2){
					setR[j].add(rs[i]);
				}
			}
		}

		debug("ys", ys);

		double sum=0;
		for(int k=0; k<m-1; k++){
			LinkedList<Double> seg=new LinkedList<Double>();
			for(R r : setR[k]){
				if(abs(r.x1-r.x2)<EPS){
					continue;
				}
				int i=seg.size(), j=seg.size();
				for(int p=seg.size()-1; p>=0; p--){
					double x=seg.get(p);
					if(x+EPS>r.x2){
						j=p;
					}
					if(x+EPS>r.x1){
						i=p;
					}
				}
				for(int p=i; p<j; p++){
					seg.remove(i);
				}
				if(j%2==0){
					seg.add(i, r.x2);
				}
				if(i%2==0){
					seg.add(i, r.x1);
				}
			}
			debug("seg", seg.toArray());
			double len=0;
			for(int i=0; i<seg.size(); i+=2){
				len=seg.get(i+1)-seg.get(i);
			}
			debug(len);
			sum+=len*(ys[k+1]-ys[k]);
		}
		return sum;
	}

	void test(){
		double[] x1={1, 3, 4, 1.0, 6., 11, 9.50, 20};
		double[] x2={2, 4, 5, 2.5, 10, 12, 10.5, 20};
		// x1=new double[20];
		// x2=new double[20];
		LinkedList<Double> seg=new LinkedList<Double>();
		for(int k=0; k<x1.length; k++){
			// x1[k]=(int)(Math.random()*2)+((int)(Math.random()*50))/50.0;
			// x2[k]=(int)(Math.random()*2)+((int)(Math.random()*50))/50.0;
			if(abs(x2[k]-x1[k])<EPS){
				continue;
			}
			if(x2[k]<x1[k]){
				double t=x1[k];
				x1[k]=x2[k];
				x2[k]=t;
			}
			int i=seg.size(), j=seg.size();
			for(int p=seg.size()-1; p>=0; p--){
				double x=seg.get(p);
				if(x>=x2[k]){
					j=p;
				}
				if(x>=x1[k]){
					i=p;
				}
			}
			debug("x1", "x2", x1[k], x2[k]);
			debug("i", "j", i, j);
			for(int p=i; p<j; p++){
				seg.remove(i);
			}
			if(j%2==0){
				seg.add(i, x2[k]);
			}
			if(i%2==0){
				seg.add(i, x1[k]);
			}
			debug(seg.toArray());
		}
		debug(seg.toArray());
	}

	class R implements Comparable<R>{
		double x1, y1, x2, y2;

		R(double x1, double y1, double x2, double y2){
			this.x1=x1;
			this.y1=y1;
			this.x2=x2;
			this.y2=y2;
		}

		@Override
		public int compareTo(R arg0){
			if(y1-y2+EPS<0){
				return -1;
			}else if(y1-y2>0+EPS){
				return 1;
			}else if(x1-x2+EPS<0){
				return -1;
			}else if(x1-x2>0+EPS){
				return 1;
			}else{
				return 0;
			}
		}
	}

	void debug(Object... os){
		// System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}