#include<bits/stdc++.h>

using namespace std;

using int64 = long long;

template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

struct UnionFind {
  vector< int > data;

  UnionFind(int sz) {
    data.assign(sz, -1);
  }

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k) {
    return (-data[find(k)]);
  }
};


template< typename T >
T kruskal(Edges< T > &edges, int V) {
  sort(begin(edges), end(edges), [](const edge< T > &a, const edge< T > &b) {
    return (a.cost < b.cost);
  });
  UnionFind tree(V);
  T ret = 0;
  for(auto &e : edges) {
    if(tree.unite(e.src, e.to)) ret += e.cost;
  }
  return (ret);
}

int main() {
  int N, X[15], Y[15], A[15];


  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> X[i] >> Y[i] >> A[i];
  }
  double dp[1 << 15] = {};
  fill_n(dp, 1 << 15, -1e30);
  for(int i = 1; i < (1 << N); i++) {
    Edges< double > edges;
    int64 sum = 0;
    for(int j = 0; j < N; j++) {
      if((i >> j) & 1) {
        sum += A[j];
        for(int k = j + 1; k < N; k++) {
          if((i >> k) & 1) {
            edges.emplace_back(j, k, hypot(X[j] - X[k], Y[j] - Y[k]));
          }
        }
      }
    }
    dp[i] = (sum - kruskal(edges, N)) / __builtin_popcount(i);
  }

  for(int bit = 0; bit < (1 << N); bit++) {
    for(int i = bit; i > 0; i = (i - 1) & bit) {
      int other = i ^bit;
      dp[bit] = max(dp[bit], min(dp[i], dp[other]));
    }
  }
  cout << fixed << setprecision(12) << dp[(1 << N) - 1] << endl;
}