#include #include #include using namespace std; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const int INF = (int)1e9 + 7; int main() { int n, p; cin >> n >> p; vector dp(p + 3, INF), dp2; dp[0] = 0; for (int _ = 0; _ < n; _++) { dp2.assign(p + 3, INF); vector a(3); for (int j: {0, 1, 2}) cin >> a[j]; a.emplace_back(1); for (int i = p; i >= 0; i--) { for (int j: {0, 1, 2, 3}) { chmin(dp2[i + j], dp[i] + a[j]); } } swap(dp, dp2); } cout << 1.0 * dp[p] / n << endl; return 0; }