// Enjoy your stay. #include #define EPS 1e-9 #define INF 1070000000LL #define MOD 1000000007LL #define all(x) (x).begin(),(x).end() #define fir first #define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++) #define ite iterator #define mp make_pair #define mt make_tuple #define rep(i,n) rep2(i,0,n) #define rep2(i,m,n) for(int i=m;i<(n);i++) #define pb push_back #define sec second #define sz(x) ((int)(x).size()) using namespace std; typedef istringstream iss; typedef long long ll; typedef pair pi; typedef stringstream sst; typedef vector vi; int n; int x[14],y[14],w[14]; double dp[14][1<<14]; int d(int i,int j){ return abs(x[i]-x[j])+abs(y[i]-y[j]); } double f(int cur,int mask){ double& res = dp[cur][mask]; if(res != -INF) return res; res = INF; double W = 0; rep(i,n)if(mask>>i&1) W += w[i]; double T = (W + 100) / 120.;cout<>i&1){ res = min(res, w[i]+T*d(cur,i) + f(i,mask^1<>x[0]>>y[0]>>n; n++; rep2(i,1,n){ cin>>x[i]>>y[i]>>w[i]; } rep(i,n)rep(j,1<