import java.util.*; import java.io.*; public class Main { static int[][] points; static int[][] dp; 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 = new int[n][p + 1]; 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[idx][p] == 0) { dp[idx][p] = Integer.MAX_VALUE; for (int i = 0; i < 4; i++) { dp[idx][p] = Math.min(dp[idx][p], dfw(idx - 1, p - i) + points[idx][i]); } } return dp[idx][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(); } }