Problem: You are given N non-overlapping circles in xy-plane. The radius of each circle varies, but the radius of the largest circle is not double longer than that of the smallest.

<image>

Figure 1: The Sample Input

The distance between two circles C1 and C2 is given by the usual formula

<image>

where (xi, yi ) is the coordinates of the center of the circle Ci, and ri is the radius of Ci, for i = 1, 2.

Your task is to write a program that finds the closest pair of circles and print their distance.



Input

The input consists of a series of test cases, followed by a single line only containing a single zero, which indicates the end of input.

Each test case begins with a line containing an integer N (2 ≤ N ≤ 100000), which indicates the number of circles in the test case. N lines describing the circles follow. Each of the N lines has three decimal numbers R, X, and Y. R represents the radius of the circle. X and Y represent the x- and y-coordinates of the center of the circle, respectively.

Output

For each test case, print the distance between the closest circles. You may print any number of digits after the decimal point, but the error must not exceed 0.00001.

Example

Input

4
1.0 0.0 0.0
1.5 0.0 3.0
2.0 4.0 0.0
1.0 3.0 4.0
0


Output

0.5

Solution (in CPP):

Solution:
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double x[110000];
double y[110000];
double r[110000];
pair<double,int>p[110000];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++){
			double tx,ty;
			scanf("%lf%lf%lf",r+i,&tx,&ty);
			x[i]=cos(1)*tx-sin(1)*ty;
			y[i]=sin(1)*tx+cos(1)*ty;
		}
		double ret=sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1]))-r[0]-r[1];
		for(int i=0;i<a;i++){
			p[i]=make_pair(x[i]+r[i],i);
		}
		std::sort(p,p+a);
		for(int i=0;i<a;i++){
			for(int j=i-1;j>=0;j--){
				if(p[i].first-r[p[i].second]*2-p[j].first>ret)break;
				int L=p[i].second;
				int R=p[j].second;
				ret=min(ret,sqrt((x[L]-x[R])*(x[L]-x[R])+(y[L]-y[R])*(y[L]-y[R]))-r[L]-r[R]);
			}
		}
		printf("%.12f\n",ret);
	}
}