import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int P = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; int[] c = new int[N]; for(int i = 0; i < N; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt(); c[i] = sc.nextInt(); } // dp[i][j]はコンテストiまでで正解数がちょうどj問の場合の順位の和の最小値(有り得ない場合は0とする) int[][] dp = new int[N][P + 1]; dp[0][0] = a[0]; dp[0][1] = b[0]; dp[0][2] = c[0]; dp[0][3] = 1; for(int i = 1; i < N; i++) { for(int j = 0; j < P + 1; j++) { int min = Integer.MAX_VALUE; if(dp[i - 1][j] != 0) min = Math.min(min, a[i] + dp[i - 1][j]); if(j >= 1 && dp[i - 1][j - 1] != 0) min = Math.min(min, b[i] + dp[i - 1][j - 1]); if(j >= 2 && dp[i - 1][j - 2] != 0) min = Math.min(min, c[i] + dp[i - 1][j - 2]); if(j >= 3 && dp[i - 1][j - 3] != 0) min = Math.min(min, 1 + dp[i - 1][j - 3]); if(min == Integer.MAX_VALUE) min = 0; dp[i][j] = min; } } System.out.println((double)dp[N - 1][P] / (double)N); } }