import java.util.*; public class Main_yukicoder134 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x0 = sc.nextInt(); int y0 = sc.nextInt(); int n = sc.nextInt(); int[] x = new int[n]; int[] y = new int[n]; double[] w = new double[n]; double tw = 0; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); w[i] = sc.nextDouble(); tw += w[i]; } double[] ww = new double[0x1 << n]; for (int i = 0; i < 0x1 << n; i++) { for (int j = 0; j < n; j++) { if ((i & 0x1 << j) != 0) { ww[i] += w[j]; } } } final double INF = Double.MAX_VALUE / 2; double[][] dp = new double[n][0x1 << n]; for (int j = 0; j < n; j++) { Arrays.fill(dp[j], INF); } // 最初の配達先 for (int k = 0; k < n; k++) { double t = (tw + 100) / 120; double dtmp = t * (Math.abs(x0 - x[k]) + Math.abs(y0 - y[k])) + w[k]; dp[k][0x1 << k] = dtmp; } for (int i = 1; i < 0x1 << n; i++) { for (int j = 0; j < n; j++) { if ((i & 0x1 << j) == 0) { continue; } for (int k = 0; k < n; k++) { if ((i & 0x1 << k) != 0) { continue; } double t = (tw - ww[i] + 100) / 120; double dtmp = t * (Math.abs(x[j] - x[k]) + Math.abs(y[j] - y[k])) + w[k]; dp[k][i | 0x1 << k] = Math.min(dp[k][i | 0x1 << k], dp[j][i] + dtmp); } } } double min = INF; for (int i = 0; i < n; i++) { double t = (double)100 / 120; double dtmp = t * (Math.abs(x0 - x[i]) + Math.abs(y0 - y[i])); min = Math.min(min, dp[i][(0x1 << n) - 1] + dtmp); } System.out.printf("%.8f\n", min); sc.close(); } }