import java.util.Arrays; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int P = sc.nextInt(); long[] DP = new long[P + 1]; long[] nextDP = new long[P + 1]; final long INF = Long.MAX_VALUE / 2 - 1; for(int i = 0; i < N; i++){ Arrays.fill(nextDP, INF); final int fst = sc.nextInt(); final int snd = sc.nextInt(); final int thd = sc.nextInt(); for(int p = 0; p <= P; p++){ nextDP[p] = Math.min(nextDP[p], DP[p] + fst); } for(int p = 0; p <= P - 1; p++){ nextDP[p + 1] = Math.min(nextDP[p + 1], DP[p] + snd); } for(int p = 0; p <= P - 2; p++){ nextDP[p + 2] = Math.min(nextDP[p + 2], DP[p] + thd); } for(int p = 0; p <= P - 3; p++){ nextDP[p + 3] = Math.min(nextDP[p + 3], DP[p] + 1); } //System.out.println(Arrays.toString(nextDP)); { long[] tmp = DP; DP = nextDP; nextDP = tmp; } } System.out.printf("%.08f\n", DP[P] / (double)(N)); } }