// Arup Guha
// 11/13/2017
// Solution to 2017 SER D1 and D2 Problem: Move Away

import java.util.*;

public class moveaway {

	public static int n;
	public static circle[] friends;
	public static pt mom;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		friends = new circle[n];

		// Here is where home is...
		mom = new pt(0,0);

		// Read in friends.
		for (int i=0; i<n; i++) {
			int x = stdin.nextInt();
			int y = stdin.nextInt();
			int r = stdin.nextInt();
			friends[i] = new circle(x, y, r);
		}

		// Here are some good points - the ones furthese from the origin in each friend circle.
		ArrayList<pt> candidates = new ArrayList<pt>();
		for (int i=0; i<n; i++)
			candidates.add(friends[i].furthestFromOrigin());

		// Or, the intersection of two circles.
		for (int i=0; i<n; i++) {
			for (int j=i+1; j<n; j++) {
				ArrayList<pt> tmp = friends[i].intersect(friends[j]);
				for (pt p: tmp)
					candidates.add(p);
			}
		}

		// Now find the best one amongst the candidates.
		double res = 0;
		for (pt p: candidates) {

			// See if this point is within each friend circle.
			boolean good = true;
			for (int i=0; i<n; i++) {
				if (!friends[i].contains(p)) {
					good = false;
					break;
				}
			}

			// If so, see if we need to update.
			if (good) res = Math.max(res, mom.dist(p));
		}

		System.out.printf("%.3f\n", res);
	}

}

class pt {

	public double x;
	public double y;

	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}

	public double dist(pt other) {
		return Math.sqrt((x-other.x)*(x-other.x) + (y-other.y)*(y-other.y));
	}
}

class circle {

	public int x;
	public int y;
	public pt center;
	public int r;

	public circle(int myx, int myy, int myr) {
		x = myx;
		y = myy;
		center = new pt(x, y);
		r = myr;
	}

	public boolean contains(pt other) {
		return center.dist(other) < r+1e-9;
	}

	// This is simple, just go in the same direction as the vector to the center...
	public pt furthestFromOrigin() {
		if (x == 0 && y == 0) return new pt(r,0);
		double mag = moveaway.mom.dist(center);
		return new pt(x + r*x/mag, y + r*y/mag);
	}

	public ArrayList<pt> intersect(circle other) {

		ArrayList<pt> res = new ArrayList<pt>();

		// Key distance.
		double d = center.dist(other.center);

		// Too far away.
		if (d > r+other.r+1e-9) return res;

		// Only one point...
		if (Math.abs(d - r - other.r) < 1e-9) {
			double dx = other.x - x;
			double dy = other.y - y;
			res.add(new pt(x + r*dx/d, y + r*dy/d));
			return res;
		}

		// Two pts - use law of cosines on either smaller triangle with r, other.r and d.
		double curAngle = Math.atan2(other.y-y, other.x-x);
		double theta = Math.acos((r*r+d*d-other.r*other.r)/(2*r*d));
		res.add(new pt(x+r*Math.cos(curAngle+theta), y+r*Math.sin(curAngle+theta)));
		res.add(new pt(x+r*Math.cos(curAngle-theta), y+r*Math.sin(curAngle-theta)));
		return res;
	}
}
