#if !__INCLUDE_LEVEL__ #include __FILE__ int main() { int n, p; input(n, p); VVI dp(n + 1, VI(p + 1, INT_MAX)); dp[0][0] = 0; rep(i, 0, n) { VI d(4, 1); rep(i, 0, 3) input(d[i]); rep(k, 0, 4) { rep(j, 0, p + 1) { if(j + k <= p && dp[i][j] != INT_MAX) { chmin(dp[i + 1][j + k], dp[i][j] + d[k]); //print(i + 1, j + k, dp[i + 1][j - k]); } } } } cout << fixed << setprecision(5); print((double)dp[n][p] / (double)n); return 0; } /* 平均順位の出し方  最後にNで割れば良い ナップザック  dp[i][j] : コストがjを超えないように選ぶ  コストの和をpにしなければならない */ #else #include using namespace std; #define _GLIBCXX_DEBUG #define rep(i, j, n) for(int i = j; i < n; i++) #define rrep(i, j, n) for(int i = n - 1; j <= i; i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define MOD1 = 998244353; #define MOD2 = 1000000007; using LL = long long; using VI = vector; using VS = vector; using VLL = vector; using VC = vector; using VD = vector; using VB = vector; using PII = pair; using PSS = pair; using PIS = pair; using PSI = pair; using PLL = pair; using PCC = pair; using VVI = vector; using VVS = vector; using VVLL = vector; using VVC = vector; using VVD = vector; using VPII = vector; using VPSS = vector; using VPIS = vector; using VPSI = vector; using VPLL = vector; template bool chmax(T& a, const T &b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T& a, const T &b) { if (a > b) { a = b; return true; } return false; } template void input(T&... a) { (cin >> ... >> a); } template void print (const T &a) { cout << a << '\n'; } template void print(const T& a, const Ts&... b) { cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; } LL power(LL n, LL k) { LL res = 1; while(k) if(k & 1) { res *= n; n *= n; k >>= 1; } return res; } LL power_mod(LL n, LL k, LL mod) { LL res = 1; while(k) { if(k & 1) res = res * n % mod; n = n * n % mod; k >>= 1; } return res; } bool is_prime(LL n) { if(n == 1) return 0; for(LL i = 2; i * i <= n; i++) if(n % i == 0) return 0; return 1; } VLL enum_divisors(LL n) { VLL res; for(LL i = 1; i * i <= n; i++) if(n % i == 0) { res.push_back(i); if(n / i != i) res.push_back(n / i); } sort(all(res)); return res; } VPLL prime_factorize(LL n) { VPLL res; for(LL i = 2; i * i <= n; i++) { if(n % i != 0) continue; LL ex = 0; while(n % i == 0) { ex++; n /= i; } res.push_back({i, ex}); } if(n != 1) res.push_back({n, 1}); return res; } #endif