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 <set>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cmath>

#define REP(i,n) for(int i=0; i<(int)(n); i++)

#define f first
#define s second
#define mp make_pair

using namespace std;

typedef pair<pair<double,double>,double> data;

template<class T> inline T dbl(T a){ return a * a; }

inline double dist(const data &a, const data &b){
  return sqrt(dbl(a.f.f - b.f.f) + dbl(a.f.s - b.f.s)) - (a.s + b.s);
}


int main(){
  int n;
  while(scanf("%d",&n), n){
    vector<data> v(n);

    REP(i,n)
      scanf("%lf%lf%lf", &v[i].s, &v[i].f.f, &v[i].f.s);

    double a1 = 0.0; REP(i,n) a1 += v[i].f.f; a1 /= n;
    double a2 = 0.0; REP(i,n) a2 += v[i].f.s; a2 /= n;

    double b1 = 0.0; REP(i,n) b1 += dbl(v[i].f.f - a1); b1 /= n;
    double b2 = 0.0; REP(i,n) b2 += dbl(v[i].f.s - a2); b2 /= n;

    if(b1 < b2) REP(i,n) swap(v[i].f.f, v[i].f.s);

    sort(v.begin(), v.end());

    double ans = 1e20;

    double r  = 0.0; REP(i,n) r = max(r, v[i].s); r *= 2;


    for(int i = 0; i < n; i++){
      double x1 = v[i].f.f;
      for(int j = i + 1; j < n; j++){
	double x2 = v[j].f.f;

	if((x2 - x1 - r) > ans) break;

	ans = min(ans, dist(v[i], v[j]));
      }
    }
    
    printf("%.6f\n", ans);
  }
  return 0;
}