#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

bool doubleEqual(double x, double y)
{
	return fabs(x - y) < 1e-9;
}
bool doubleLess(double x, double y)
{
	return x < y && !doubleEqual(x, y);
}
bool doubleGreater(double x, double y)
{
	return x > y && !doubleEqual(x, y);
}
bool doubleLessOrEqual(double x, double y)
{
	return x < y || doubleEqual(x, y);
}
bool doubleGreaterOrEqual(double x, double y)
{
	return x > y || doubleEqual(x, y);
}
double sqr(double x)
{
	return x * x;
}
double mySqrt(double x)
{
	if (doubleLess(x, 0) )
		throw 42;
	if (x < 0)
		return 0;
	return sqrt(x);
}
int sgn(double x)
{
	if (doubleEqual(x, 0) )
		return 0;
	if (x < 0)
		return -1;
	return 1;
}

const double pi = atan2(0., -1.);

struct Point
{
	double x, y;
	Point() : x(), y() {}
	Point(double _x, double _y) : x(_x), y(_y) {}
	Point operator + (const Point &A) const
	{
		return Point(x + A.x, y + A.y);
	}
	Point operator - (const Point &A) const
	{
		return Point(x - A.x, y - A.y);
	}
	double operator % (const Point &A) const
	{
		return x * A.x + y * A.y;
	}
	double operator * (const Point &A) const
	{
		return x * A.y - y * A.x;
	}
	Point operator * (double a)
	{
		return Point(x * a, y * a);
	}
	Point operator / (double a)
	{
		return Point(x / a, y / a);
	}
	double length() const
	{
		return mySqrt(*this % *this);
	}
	double distTo(Point A)
	{
		return (*this - A).length();
	}
	Point rotate()
	{
		return Point(-y, x);
	}
	Point rotate(double alpha)
	{
		Point v = *this;
		Point u = rotate();
		return v * cos(alpha) + u * sin(alpha);
	}
	Point normalize(double l)
	{
		double len = length();
		if (doubleEqual(len, 0) )
			throw 42;
		return *this * (l / len);
	}
	double getAngle() const
	{
		double xx = atan2(Point(1, 0) * *this, Point(1, 0) % *this);
		if (doubleLess(xx, 0) )
			xx = 2 * pi + xx;
		return xx;
	}

	bool operator < (const Point &A) const
	{
		if (!doubleEqual(x, A.x) ) 
			return x < A.x;
		return doubleLess(y, A.y);
	}
	bool operator == (const Point &A) const
	{
		return doubleEqual(x, A.x) && doubleEqual(y, A.y);
	}
	void read()
	{
		scanf("%lf%lf", &x, &y);
	}
	void print() const
	{
		fprintf(stderr, "%.10lf %.10lf\n", x, y);
	}
	bool onLine(Point A, Point B)
	{
		return doubleEqual( (*this - A) * (B - A), 0);
	}
	bool onSegment(Point A, Point B)
	{
		if (!onLine(A, B) )
			return false;
		if (*this == A || *this == B)
			return true;
		return doubleGreaterOrEqual( (*this - A) % (B - A), 0) && doubleGreaterOrEqual( (*this - B) % (A - B), 0);
	}
};


const int N = 15;
int n;
int par[N];

int getP(int x)
{
	if (par[x] == x) return par[x];
	return par[x] = getP(par[x] );
}

bool uni(int a, int b)
{
	a = getP(a);
	b = getP(b);
	if (a == b) return false;
	par[a] = b;
	return true;
}

Point P[N];
double a[N];
vector <double> b;
vector <Point> v;

double solveMask(int mask)
{
	b.clear();
	v.clear();
	for (int i = 0; i < n; i++)
		if (mask & (1 << i) )
		{
			v.push_back(P[i] );
			b.push_back(a[i] );
		}
	for (int i = 0; i < n; i++)
		par[i] = i;
	vector <pair <double, pair <int, int> > > e;
	int k = (int) v.size();
	for (int i = 0; i < k; i++)
		for (int j = i + 1; j < k; j++)
			e.emplace_back(v[i].distTo(v[j] ), make_pair(i, j) );
	sort(e.begin(), e.end() );

	double cost = 0;
	for (auto p : e)
	{
		if (uni(p.second.first, p.second.second) )
			cost += p.first;
	}
	
	double sum = 0;
	for (double x : b)
		sum += x;
	return (sum - cost) / k;
}

double ansMask[1 << N];

int main(int,  char **)
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		P[i].read();
		scanf("%lf", &a[i] );
	}
	for (int mask = 1; mask < (1 << n); mask++)
		ansMask[mask] = solveMask(mask);

	for (int mask = 1; mask < (1 << n); mask++)
	{
		for (int sub = mask; sub > 0; sub = (sub - 1) & mask)
			ansMask[mask] = max(ansMask[mask], min(ansMask[sub], ansMask[mask ^ sub] ) );
	}
	printf("%.10lf\n", ansMask[(1 << n) - 1]);


	return 0;
}



Measured memory_bytes: 512