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 <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define ele int
using namespace std;
#define maxn 100010
#define INF 1e18
#define eps 1e-7
struct circle{
	double x,y,r;
};
ele n;
double R;
circle a[maxn];
inline bool cmp1(circle a,circle b){
	return a.x<b.x;
}
inline bool cmp2(circle a,circle b){
	return a.y<b.y;
}
inline double dis(circle a,circle b){
	return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))-a.r-b.r;
}
double solve(ele l,ele r){
	if (r-l+1<=10){
		double ans=INF;
		for (int i=l; i<=r; ++i)
			for (int j=i+1; j<=r; ++j)
				ans=min(ans,dis(a[i],a[j]));
		return ans;
	}
	ele mid=(l+r)>>1;
	double ans=min(solve(l,mid-1),solve(mid+1,r));
	for (int i=l; i<=r; ++i)
		if (i!=mid) ans=min(ans,dis(a[i],a[mid]));
	static circle p[maxn],q[maxn];
	ele u=0,v=0;
	for (int i=l; i<mid; ++i)
		if (a[mid].x-a[i].x<ans+R*2+eps) p[u++]=a[i];
	for (int i=mid+1; i<=r; ++i)
		if (a[i].x-a[mid].x<ans+R*2+eps) q[v++]=a[i];
	if (!v) return ans;
	sort(p,p+u,cmp2); sort(q,q+v,cmp2);
	ele s=0,t=0;
	for (int i=0; i<u; ++i){
		while (s<v-1 && p[i].y-q[s].y>ans+R*2+eps) ++s;
		while (t<v-1 && q[t+1].y-p[i].y<ans+R*2+eps) ++t;
		for (int j=s; j<=t; ++j) ans=min(ans,dis(p[i],q[j]));
	}
	return ans;
}
int main(){
	while (scanf("%d",&n),n){
		R=0;
		for (int i=0; i<n; ++i){
			scanf("%lf%lf%lf",&a[i].r,&a[i].x,&a[i].y);
			R=max(R,a[i].r);
		}
		sort(a,a+n,cmp1);
		printf("%.10lf\n",solve(0,n-1));
	}
	return 0;
}