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<algorithm>
#include<cmath>
#include<iomanip>
 
using namespace std;
 
const double eps = 1e-9;
 
 
bool eq(double a, double b){
  return abs(b-a)<eps;
}
 
bool ls(double a, double b){
  return !eq(a,b) && a<b;
}
 
class Point{
public:
  double r,x,y;
  bool operator<(const Point &a)const{
    if(!eq(x,a.x))return ls(x,a.x);
    return ls(y,a.y);
  }
   
  double dist(const Point &a)const{
    return sqrt((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y))-r-a.r;
  }
};
 
double min_val = 1e80;
const double MAXPOINT = 1e80;
 
Point BigPoint = {0,MAXPOINT,MAXPOINT};
 
void Merge(Point *a, int l, int mid, int r, double midx){
  int n1 = mid-l+1, n2 = r-mid,pr=0,pl=0;
  Point L[n1+1], R[n2+1];
  for(int i = 0; i < n1; ++i) L[i] = a[l+i];
  for(int i = 0; i < n2; ++i) R[i] = a[mid+1+i];
   
  L[n1] = R[n2] = BigPoint;
  for(int i = l; i < r + 1; ++i){
    if( L[pl].y < R[pr].y ) a[i] = L[pl++];
    else a[i] = R[pr++];
  }
  Point p1 = BigPoint, p2 = BigPoint, p3 = BigPoint, p4 = BigPoint;
  for(int i = l; i < r+1; ++i){
    //if( ls( abs(midx-a[i].x), min_val) ){
      min_val = min(min_val, a[i].dist(p1));
      min_val = min(min_val, a[i].dist(p2));
      min_val = min(min_val, a[i].dist(p3));
      min_val = min(min_val, a[i].dist(p4));
      p1=p2;p2=p3;p3=p4;p4=a[i];
      //}
  }
}
 
void MergeSort( Point *a, int l, int r){
  if(l<r){
    int q = (r+l)/2;
    double midx = a[q].x;
    MergeSort(a,l,q);
    MergeSort(a,q+1,r);
    Merge(a,l,q,r,midx);
  }
}
 
int main()
{
  int n;
  while(cin >> n && n){
    Point a[n];
    min_val = 1e80;
    for(int i = 0; i < n; ++i)cin>>a[i].r>>a[i].x>>a[i].y;
    sort(a,a+n);
    MergeSort(a,0,n-1);
    cout << fixed << setprecision(10) << min_val << endl;
  }
  return 0;
}