import java.io.*; import java.util.*; public class Main { static Point[] points; static int count; static double[][] dp; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); Point start = new Point(sc.nextInt(), sc.nextInt(), 0); int n = sc.nextInt(); points = new Point[n + 1]; count = n + 1; points[0] = start; double total = 0; for (int i = 1; i <= n; i++) { points[i] = new Point(sc.nextInt(), sc.nextInt(), sc.nextDouble()); total += points[i].weight; } dp = new double[count][1 << count]; System.out.println(dfw(0, (1 << count) - 1) + total); } static double dfw(int idx, int mask) { if (dp[idx][mask] != 0) { return dp[idx][mask]; } if (mask == 1) { return dp[idx][mask] = points[0].getDistance(points[idx]) * 100 / 120; } double min = Double.MAX_VALUE; double weight = 0; for (int i = 1; i < count; i++) { if (((1 << i) & mask) != 0) { weight += points[i].weight; } } for (int i = 1; i < count; i++) { if (((1 << i) & mask) == 0) { continue; } min = Math.min(min, dfw(i, mask ^ (1 << i)) + points[idx].getDistance(points[i]) * (100 + weight) / 120); } return dp[idx][mask] = min; } static class Point { int x; int y; double weight; public Point(int x, int y, double weight) { this.x = x; this.y = y; this.weight = weight; } public double getDistance(Point p) { return Math.abs(p.x - x) + Math.abs(p.y - y); } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }