#include using namespace std; using ll = long long; using ull = unsigned long long; double hyp(double x, double y) { return sqrt(x*x + y*y); } struct Cow { int x, y, r; double dist(double xx, double yy) { return max(0.0, hyp(xx-x, yy-y) - r); } }; int main() { ios::sync_with_stdio(0); cin.tie(0); cout << setprecision(8); int n; cin >> n; vector cs(n); Cow sumc = {0, 0, 0}; for(int i = 0; i < n; ++i) { int x, y, r; cin >> x >> y >> r; cs[i] = {x, y, r}; sumc.x += x; sumc.y += y; sumc.r += r; } if(n == 1) { cout << 0 << '\n'; return 0; } double x = 1.0*sumc.x / n; double y = 1.0*sumc.y / n; double mmaxd = 1000000000; for(double m = 50; m > 0.0000002; m *= 0.99) { Cow maxf = cs[0]; double maxd = cs[0].dist(x, y); for(auto c : cs) { double d = c.dist(x, y); if(d > maxd) { maxd = d; maxf = c; } } mmaxd = min(maxd, mmaxd); x += m*(maxf.x-x)/hyp(maxf.x-x, maxf.y-y); y += m*(maxf.y-y)/hyp(maxf.x-x, maxf.y-y); } cout << mmaxd << '\n'; return 0; }