#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; double dp[1<<14][14]; const double INF = numeric_limits::max(); int main(){ int N; vi X(1), Y(1); cin >> X[0] >> Y[0] >> N; N++; vector W(N), wsum(1ull<> X[i] >> Y[i] >> W[i]; } rep(i, 1 << N){ rep(j, N)if(i >> j&1)wsum[i] += W[j]; } rep(i, 1<>j&1)){ int d = abs(X[i] - X[j]) + abs(Y[i] - Y[j]); double t = (wsum[S] + 100)*d / 120.0; smin(dp[1 << j | S][j], dp[S][i]+t + W[j]); } } } cout << setprecision(20) << dp[(1 << N) - 1][0] << endl; }