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 JAVA):

Solution:
import java.util.Arrays;

public class Main {
	Scanner sc = new Scanner();

	class Scanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}
		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}
	}

	void run() {
		for (;;) {
			int N = sc.nextInt();
			if (N == 0) {
				return;
			}
			Circle[] info = new Circle[N];
			for (int i = 0; i < N; i++) {
				info[i] = new Circle(sc.nextDouble(), sc.nextDouble(),
						sc.nextDouble());
			}
			double min = Double.MAX_VALUE;
			double dist = 0;
			Arrays.sort(info);
			for (int i = 0; i < N; i++) {
				for (int j = i + 1; j < N; j++) {
					if (j > i + 50) {
						break;
					}
					dist = Math.hypot(info[i].x - info[j].x, info[i].y
							- info[j].y);
					min = Math.min(min, dist - info[i].r - info[j].r);
				}
			}
			System.out.println(min);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	class Circle implements Comparable<Circle> {
		double r;
		double x;
		double y;

		Circle(double r, double x, double y) {
			this.r = r;
			this.x = x;
			this.y = y;
		}

		public int compareTo(Circle c) {
			return (int) (this.x - c.x);
		}
	}
}