# include using namespace std; typedef long long ll; const int N = 15; ll n; ll x[N], y[N]; double ans, w[N]; double dp[N][1 << N], W[1 << N]; double dis(ll i, ll j) {return abs(x[i] - x[j]) + abs(y[i] - y[j]);} int main() { scanf("%lld%lld%lld", &x[0], &y[0], &n); for (int i = 1; i <= n; i++) scanf("%lld%lld%lf", &x[i], &y[i], &w[i]); for (int S = 0; S < (1 << n); S++) { for (int i = 1; i <= n; i++) { if (!(S & (1 << (i - 1)))) W[S] += w[i]; dp[i][S] = 1e18; } } for (int i = 1; i <= n; i++) dp[i][1 << (i - 1)] = dis(0, i) * (W[0] + 100.0) / 120.0 + w[i]; for (int S = 1; S < (1 << n); S++) { for (int i = 1; i <= n; i++) { if (S & (1 << (i - 1))) { for (int j = 1; j <= n; j++) { if (i == j) continue; if (S & (1 << (j - 1))) { dp[i][S] = min(dp[i][S], dp[j][S ^ (1 << (i - 1))] + dis(i, j) * (W[S ^ (1 << (i - 1))] + 100.0) / 120.0 + w[i]); } } } } } ans = 1e18; for (int i = 1; i <= n; i++) { ans = min(ans, dp[i][(1 << n) - 1] + dis(i, 0) * 100.0 / 120.0); } printf("%.7f\n", ans); return 0; }