import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.bitmanip; // BitArray void main() { auto rd = readln.split.to!(int[]), n = rd[0], l = rd[1] * 60; auto si = readln.split.map!(s => s[0..2].to!int * 60 + s[3..5].to!int).array; if (l >= si.sum) { writeln(n); return; } auto dp = new long[][][](n + 1, l + 1, n + 1); dp[0][0][0] = 1; foreach (i; 0..n) foreach (j; 0..l+1) { dp[i+1][j][] = dp[i][j][]; if (j >= si[i]) dp[i+1][j][1..$][] += dp[i][j - si[i]][0..$-1][]; } auto fact = new real[](n + 1); fact[0] = 1; foreach (i; 1..n+1) fact[i] = fact[i-1] * i; auto r = real(0); foreach (j; 0..n) { foreach (m; l-si[j]..l) foreach (k; 0..n) { auto a = dp[n][m][k]; if (m - si[j] >= 0 && k > 0) a -= dp[n-1][m - si[j]][k-1]; r += a * fact[k] * fact[n-k-1] * (k+1) / fact[n]; } } writefln("%.10f", r); }