Problem: There are N cities in a two-dimensional plane. The coordinates of the i-th city is (x_i, y_i). Initially, the amount of water stored in the i-th city is a_i liters.

Snuke can carry any amount of water from a city to another city. However, water leaks out a bit while he carries it. If he carries l liters of water from the s-th city to the t-th city, only max(l-d_{s,t}, 0) liters of water remains when he arrives at the destination. Here d_{s,t} denotes the (Euclidean) distance between the s-th city and the t-th city. He can perform arbitrary number of operations of this type.

Snuke wants to maximize the minimum amount of water among the N cities. Find the maximum X such that he can distribute at least X liters of water to each city.

Constraints

* 1 ≤ N ≤ 15
* 0 ≤ x_i, y_i, a_i ≤ 10^9
* All values in the input are integers.
* No two cities are at the same position.

Input

The input is given from Standard Input in the following format:


N
x_1 y_1 a_1
:
x_N y_N a_N


Output

Print the maximum of the minimum amount of water among the N cities. The absolute error or the relative error must be at most 10^{-9}.

Examples

Input

3
0 0 10
2 0 5
0 5 8


Output

6.500000000000


Input

15
335279264 849598327 822889311
446755913 526239859 548830120
181424399 715477619 342858071
625711486 448565595 480845266
647639160 467825612 449656269
160714711 336869678 545923679
61020590 573085537 816372580
626006012 389312924 135599877
547865075 511429216 605997004
561330066 539239436 921749002
650693494 63219754 786119025
849028504 632532642 655702582
285323416 611583586 211428413
990607689 590857173 393671555
560686330 679513171 501983447


Output

434666178.237122833729

Solution (in CPP):

Solution:
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

const double INF=1e10;

int n;
pi ps[20];
double d[20][20];
int ar[20];
double sq(double a){
  return a*a;
}
struct uf{

  static const int MAXN=18;
  int par[MAXN];
  int size[MAXN];
  void init(){
    memset(par,-1,sizeof(par));
    REP(i,MAXN) size[i]=1;
  }
  int root(int a){
    if(par[a]==-1) return a;
    return par[a]=root(par[a]);
  }
  void unite(int a,int b){
    a=root(a);b=root(b);
    if(a==b) return;
    if(size[a]<size[b]) swap(a,b);

    par[b]=a;
    size[a]+=size[b];
  }
  bool same(int a,int b){
    return root(a)==root(b);
  }
};


uf u;
vector<int> g[20];
pair<double,pi> es[150];

double dfs(int v,int p,double thr){
  double cur=ar[v];
  for(auto to:g[v]){
    if(to==p) continue;
    double a=dfs(to,v,thr);
    if(a>0){
      cur-=d[v][to]+a;
    }else{
      cur+=max(0.0,-a-d[v][to]);
    }
  }
  return -(cur-thr);
}
bool check(double thr,int r){
  double req=dfs(r,-1,thr);
  if(req<=0) return true;
  return false;
}
double calc(int bit){
  int m=0;
  int r=-1;
  REP(i,n) g[i].clear();
  REP(i,n) if(bit>>i&1){
    REP(j,i) if(bit>>j&1){
      es[m++]=mp(d[i][j],mp(i,j));
    }
    r=i;
  }
  sort(es,es+m);
  u.init();
  REP(i,m){
    int a=es[i].sc.fr,b=es[i].sc.sc;
    if(!u.same(a,b)){
      u.unite(a,b);
      g[a].pb(b);
      g[b].pb(a);
    }
  }

  double lb=0,ub=1e9+10;
  REP(i,100){
    double md=(lb+ub)/2;
    if(check(md,r)) lb=md;
    else ub=md;
  }
  return lb;
}

double wat[1<<15];
double dp[1<<15];
int main(){
  cin>>n;
  REP(i,n){
    cin>>ps[i].fr>>ps[i].sc>>ar[i];
  }
  REP(i,n) REP(j,n) {
    d[i][j]=sqrt(sq(ps[i].fr-ps[j].fr)+sq(ps[i].sc-ps[j].sc));
  }

  REP(i,1<<n) if(i>0){
    wat[i]=calc(i);
  }
  dp[0]=INF;
  for(int i=1;i<(1<<n);++i){
    int cur=i;
    do{
      chmax(dp[i],min(wat[cur],dp[i^cur]));
      cur=(cur-1)&i;
    }while(cur>0);
  }
  printf("%.10f\n",dp[(1<<n)-1]);
  return 0;
}