#include "bits/stdc++.h"
using namespace std;


double dp[1 << 13][13];
double INF = 1e100;

double hyp(double A, double B){
	return abs(A) + abs(B);
}

int main() {
	int X0, Y0;
	cin >> X0 >> Y0;
	int N;
	cin >> N;
	vector<int> X(N);
	vector<int> Y(N);
	vector<double> W(N);
	for (int i = 0; i < N; i++)
	{
		cin >> X[i] >> Y[i] >> W[i];
	}
	for (int i = 0; i < (1 << N); i++)
	{
		for (int j = 0; j < N; j++)
		{
			dp[i][j] = INF;
		}
	}
	double sumW = 0;
	for (int i = 0; i < N; i++)
	{
		sumW += W[i];
	}

	for (int i = 0; i < N; i++)
	{
		dp[(1 << N) - 1 - (1 << i)][i] = hyp(X0 - X[i], Y0 - Y[i]) * (sumW + 100) / 120;
	}

	for (int i = (1 << N) - 1; i >= 0; i--)
	{
		double SW = 100;
		for (int j = 0; j < N; j++)
		{
			if ((i >> j) % 2) SW += W[j];
		}
		for (int j = 0; j < N; j++)
		{
			if (dp[i][j] == INF) continue;
			for (int k = 0; k < N; k++)
			{
				if ((i >> k) % 2 == 0) continue;
				dp[i - (1 << k)][k] = min(dp[i | (1 << k)][k], dp[i][j] + hyp(X[j] - X[k], Y[j] - Y[k]) * SW / 120);
			}
		}
	}

	double ans = INF;
	for (int i = 0; i < N; i++)
	{
		ans = min(ans, dp[0][i] + (hyp(X0 - X[i], Y0 - Y[i]) * 100) / 120);
	}

	ans += sumW;
	printf("%.14f\n", ans);
	cin >> ans;
}