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<bits/stdc++.h>
using namespace std;
#define EPS 1e-10
typedef pair<double,int> P;
struct Point{double x,y,r;};
int n;
Point p[100010];

double cl(int i,int j,double k=0.0){
  return sqrt(pow(p[i].x-p[j].x,2)+pow(p[i].y-p[j].y,2))-(p[i].r+p[j].r+k*2.0);
}

int solve(double k){
  
  vector<P> events;
  
  for(int i=0;i<n;i++){
    double x1=p[i].x-p[i].r-k;
    double x2=p[i].x+p[i].r+k;
    events.push_back(P(x1,i));
    events.push_back(P(x2,i+n));
  }
  sort(events.begin(),events.end());

  set<P> outers;
  for(int i=0;i<events.size();i++){
    int id=events[i].second%n;
    if(events[i].second<n){
      set<P>::iterator it = outers.lower_bound(P(p[id].y,id));
      if(it!=outers.end()&&cl(id,it->second,k)<=0)return 0;
      if(it!=outers.begin()&&cl(id,(--it)->second,k)<=0)return 0;
      outers.insert(P(p[id].y,id));
    }else{
      outers.erase(P(p[id].y,id));
    }
  }
  return 1;
}

int main(){
  
  while(cin>>n,n){

    for(int i=0;i<n;i++){
      cin>>p[i].r>>p[i].x>>p[i].y;
    }

    double ok=0,ng=cl(0,1),mid;
    while(ng-ok>EPS){
      mid=(ok+ng)/2.0;
      if(solve(mid))ok=mid;
      else ng=mid;
    }
  
    printf("%.10lf\n",ok*2.0);
  }
  return 0;
}