#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair i_i; typedef pair ll_i; typedef pair d_i; typedef pair ll_ll; typedef pair d_d; struct edge { int v, w; }; ll MOD = 1000000007; ll _MOD = 1000000009; double EPS = 1e-10; int INF = INT_MAX / 4; int main() { int N, L; cin >> N >> L; L *= 60; vector a(N); for (int i = 0; i < N; i++) { int MM, SS; scanf("%d:%d", &MM, &SS); a[i] = MM * 60 + SS; } double e = 0; for (int i = 0; i < N; i++) { vector > dp(N, vector(L)); dp[0][0] = 1; int z = 0; for (int j = 0; j < N; j++) { if (j == i) continue; vector > _dp(N, vector(L)); for (int l = 0; l <= z; l++) for (int k = 0; k < L; k++) { if (dp[l][k] == 0) continue; int x = l, y = z - l; _dp[l][k] += dp[l][k] * (y + 1) / (x + y + 2); if (k + a[j] < L) _dp[l + 1][k + a[j]] += dp[l][k] * (x + 1) / (x + y + 2); } dp = _dp; z++; } double sum = 0; for (int l = 0; l < N; l++) for (int k = 0; k < L; k++) sum += dp[l][k]; e += sum; } printf("%.10f\n", e); }