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:
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

/*
thx
http://cf16-exhibition-final-open.contest.atcoder.jp/submissions/1005311
*/

struct City{//位置x,位置y,水量
	int x,y,a;
};
void solve(){
	int N;
	cin >> N;
	vector<City> cities(N);
	for(int i=0;i<N;++i){
		int x,y,a;
		cin >> x >> y >> a;
		//cities[i] = {x,y,a};
		cities[i].x = x;
		cities[i].y = y;
		cities[i].a = a;
	}
	//dist[i][j]:=i,j間の距離
	vector< vector<double> > dist(N,vector<double>(N));
	for(int i=0;i<N;++i){
		for(int j=0;j<N;++j){
			//ユークリッド距離
			//dist[i][j] = hypot(cities[i].x-cities[j].x, cities[i].y-cities[j].y);
			//Cityの中がint
			// 10^5*10^5 などでOVF
			/*dist[i][j] = (cities[i].x-cities[j].x)*(cities[i].x-cities[j].x)
				+(cities[i].y-cities[j].y)*(cities[i].y-cities[j].y);
			dist[i][j] = sqrt( dist[i][j] );
			*/
			double X = (cities[i].x-cities[j].x);
			double Y = (cities[i].y-cities[j].y);
			dist[i][j] = sqrt(X*X+Y*Y);
		}
	}
	
	//初期化
	vector<double> mstCost(1<<N,1e99);
	for(int i=0;i<N;++i){
		mstCost[1<<i] = 0;
	}

	/*
	集合Sを連結にするための最小コスト:最小全域木
	(MST:Minimum Spanning Tree)
	*/
	for(int S=1;S<(1<<N)-1;++S){
		double x = mstCost[S];
		for(int i=0;i<N;++i){
			if( (S >> i) & 1 ){//
				for(int j=0;j<N;++j){
					if( ~S >> j & 1){//
						mstCost[S|(1<<j)] = min(mstCost[S|(1<<j)],
							x + dist[i][j]);
					}
				}
			}
		}
	}

	/////
	/*
	ある部分集合Sで、水量の平均を最大化すると
	value[S]になる。かな？
	*/
	vector<double> value(1<<N,0);
	for(int S=1;S<(1<<N);++S){
		double sumA = 0;//Sに含まれる都市の水量
		int K = 0;//Sに含まれる都市の数
		for(int i=0;i<N;++i){
			if( (S>>i) & 1 ){
				sumA += cities[i].a;
				++K;
			}
		}
		value[S] = max(0.0, sumA - mstCost[S]) / K;
	}

	/////
	vector<double> dp(1<<N);
	dp[0] = 1e99;
	/*
	あるSのときSの部分集合は計算済み
	*/
	for(int S=1;S<(1<<N);++S){
		double x = 0;//dp[S]での最大値を入れる

		//Sを分割して、それぞれ最小値の最大値を見る
		for(int T = S; T> 0 ; (--T) &= S ){
			//T=0の場合,value[0]=0 => min(value[0],dp[S]) => 0
			//max(x,0) => x
			x = max(x, min(value[T],dp[S-T]) );
		}
		dp[S] = x;
	}
	double ans = dp.back();//dp[(1<<N)-1];//dp.back();
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()