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<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cassert>
#include<iomanip>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
#define eps (1e-8)
#define equals(a,b) (fabs((a)-(b)) < eps)
#define MAX 2000000
#define all(n) (n).begin(),(n).end()
using namespace std;
struct Circle
{
  double x,y,r;
  Circle(double x=inf,double y=inf,double r=inf):x(x),y(y),r(r){}
  bool operator < (const Circle& c)const
  {
    if(!equals(x,c.x))return x < c.x;
    return y < c.y;
  }
};

bool compare_y(Circle a,Circle b)
{
  return a.y < b.y;
}

int N;
Circle A[MAX];

double compute(Circle *a,int n)
{
  if(n <= 1)return inf;
  int m = n/2;
  double x = a[m].x;
  double y = a[m].y;
  double r = a[m].r;
  double d = min(compute(a,m),compute(a+m,n-m));
  inplace_merge(a,a+m,a+n,compare_y);

  vector<Circle> b;

  rep(i,n)
    {
      double nx = a[i].x - x;
      double ny = a[i].y - y;
      double ndist = sqrt(nx*nx + ny*ny) - a[i].r - r;
      //if(equals(ndist,d) || ndist > d)continue;
      //if(nx >= d)continue;
     
      rep(j,(int)min((int)b.size(),10))
	{
	  int last = b.size()-j-1;
	  double dx = a[i].x - b[last].x;
	  double dy = a[i].y - b[last].y;
	  double dist = sqrt(dx*dx + dy*dy) - a[i].r - b[last].r;

	  if(equals(dist,d) || dist > d)continue;
	  d = min(d,sqrt(dx*dx + dy*dy) - a[i].r - b[last].r);
	}
      b.push_back(a[i]);
    }
  return d;
}



int main()
{
  while(cin >> N,N)
    {
      assert(N < MAX);
      rep(i,N)cin >> A[i].r >> A[i].x >> A[i].y;
      sort(A,A+N);


      cout << setiosflags(ios::fixed) << setprecision(8) << compute(A,N) << endl;
    }
  return 0;
}