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 <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef complex<double> P;
struct C {
  P p; double r;
  C(const P &p, double r) : p(p), r(r) { }
  C() {}
};
bool p1(const C &a, const C &b) {
  return a.p.real() != b.p.real() ? a.p.real() < b.p.real() : a.p.imag() < b.p.imag();
}
bool p2(const C &a, const C &b) {
  return a.p.imag() != b.p.imag() ? a.p.imag() < b.p.imag() : a.p.real() < b.p.real();
}


C circle[100000];
double minR;

double solve(int s, int t) {
  if (s+1>=t) return INF;
  double m1 = solve(s, (s+t)/2);
  double m2 = solve((s+t)/2, t);
  double mid = (circle[(s+t)/2-1].p.real() + circle[(s+t)/2].p.real()) / 2;
  double d = min(m1, m2) + 2*minR + 1;
  int start = lower_bound(circle+s, circle+t, C(P(mid-d-1, -INF), 0), p1) - circle;
  int end = upper_bound(circle+s, circle+t, C(P(mid+d, INF), 0), p1) - circle;
  vector<C> v;
  //cout << s << " " <<t << endl;
  for (int i=start; i<end; ++i) {
    v.push_back(circle[i]);
    //cout << circle[i].p << endl;
  }
  sort(ALL(v), p2);
  double res = min(m1, m2);
  for (int i=0; i<v.size(); ++i) {
    for (int k=i+1; k<v.size() && (v[k].p.imag()-v[i].p.imag())<d; ++k) {
      res = min(res, abs(v[k].p-v[i].p)-v[k].r-v[i].r);
    }
  }
  //cout << res << endl;
  return res;
}

int main() {
  int n;
  while(cin>>n,n) {
    minR = INF;
    REP(i,n) {
      double x, y, r;
      cin >> r >> x >> y;
      circle[i] = C(P(x,y),r);
      minR = min(minR, r);
    }
    sort(circle, circle+n, p1);
    printf("%.10f\n", solve(0, n));
  }
}