#include<queue>
#include<cmath>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}
inline int bits(int m) { return (1<<m)-1; }
using Double = double;
const Double INF = 1e100;

int N;
LL X[15], Y[15], A[15];

Double D[15][15];
Double cst[1<<15];
Double sum[1<<15];
Double dp[1<<15];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%lld%lld%lld", X+i, Y+i, A+i);

    REP (s, 1<<N) if (s) {
	REP (i, N) if (s>>i&1) {
	    sum[s] = sum[s^(1<<i)] + A[i];
	    break;
	}
    }

    REP (i, N) REP (j, N) D[i][j] = hypot((Double)X[i]-X[j], (Double)Y[i]-Y[j]);
    REP (s, 1<<N) cst[s] = INF;
    REP (s, 1<<N) {
	if (__builtin_popcount(s) <= 1) cst[s] = 0;
	REP (i, N) if (s>>i&1) REP (j, N) if (~s>>j&1) amin(cst[s|1<<j], cst[s] + D[i][j]);
    }

    dp[0] = INF;
    REP (s, 1<<N) if (dp[s] > 0) {
	int other = bits(N) ^ s;
	if (other == 0) continue;
	int sup = other & (other-1);
	int small = sup ^ other;
	for (int t=sup; ; t=(t-1)&sup) {
	    int pc = __builtin_popcount(t|small);
	    Double val = (sum[t|small] - cst[t|small]) / pc;
	    amax(dp[s|t|small], min(val, dp[s]));
	    if (t == 0) break;
	}
    }
    double ans = dp[bits(N)];
    printf("%.12f\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}

