import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double x0 = sc.nextDouble(); double y0 = sc.nextDouble(); int n = sc.nextInt(); double[] x = new double[n]; double[] y = new double[n]; double[] w = new double[n]; for(int i = 0; i < n; i++) { x[i] = sc.nextDouble(); y[i] = sc.nextDouble(); w[i] = sc.nextDouble(); } int p = (int)Math.pow(2, n); double[][] dp = new double[p][n + 1]; for(int i = 1; i < p; i++) { for(int j = 0; j < n + 1; j++) { dp[i][j] = 1000000000; } } double[] s = new double[p]; for(int i = 1; i < p; i++) { for(int j = 0; j < n; j++) { if((i & (1 << j)) != 0) s[i] += w[j]; } } double sum = s[p - 1]; for(int i = 1; i < p; i++) { for(int j = 0; j < n; j++) { if((i & (1 << j)) != 0) { int i1 = i - (1 << j); for(int k = 0; k < n; k++) { if(dp[i1][k + 1] != 1000000000) { double t = dp[i1][k + 1]; t = (t + (((double)Math.abs(x[k] - x[j]) + (double)Math.abs(y[k] - y[j])) * (double)(sum - s[i1] + 100)) / (double)(120)); dp[i][j] = Math.min(dp[i][j], t); } } } } } double ans = 1000000000; for(int j = 0; j < n; j++) { double t = dp[p - 1][j + 1]; t = (t + (((double)Math.abs(x0 - x[j]) + (double)Math.abs(y0 - y[j])) * (double)100) / (double)(120)); ans = Math.min(ans, t); } System.out.println(ans); } }