import java.util.*; import java.io.*; public class Main { static int[][] points; static ArrayList> dp = new ArrayList<>(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int p = sc.nextInt(); points = new int[n][4]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { points[i][j] = sc.nextInt(); } points[i][3] = 1; dp.add(new HashMap<>()); } double all = dfw(n - 1, p); System.out.println(all / n); } static int dfw(int idx, int p) { if (p < 0) { return Integer.MAX_VALUE / 2; } if (idx < 0) { return 0; } if ((idx + 1) * 3 <= p) { return idx + 1; } if (!dp.get(idx).containsKey(p)) { int value = Integer.MAX_VALUE; for (int i = 0; i < 4; i++) { value = Math.min(value, dfw(idx - 1, p - i) + points[idx][i]); } dp.get(idx).put(p, value); } return dp.get(idx).get(p); } } 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 nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }