// #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include #define ll long long #define ull unsigned long long #define pii pair #define pp pair,pair> #define pll pair #define pdd pair #define vii vector #define vll vector #define mat vector> #define lb lower_bound #define ub upper_bound #define pb push_back #define fi first #define sc second #define rep(i,n) for(ll i=0;i=0;i--) #define all(x) x.begin(),x.end() #define sz(x) (ll) (x).size() #define pq priority_queue #define pqg priority_queue,greater> #define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin()) #define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin()) #define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end()) #define int ll using namespace std; const ll INF = (1 << 30 ) - 1; const ll LLINF = (1LL << 60LL); const ll MOD = 1000000007; const ll mod = 998244353; const ll MAX = 1100000; const double pi = acos(-1); const double eps = 1e-10; ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1}; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } struct Timer{ chrono::system_clock::time_point start, end; Timer(){ start = chrono::system_clock::now(); } ~Timer(){ end = chrono::system_clock::now(); auto msec = chrono::duration_cast(end - start).count(); cerr<<"time : "<>n>>p; int a[5010][4]; rep(i,n){ cin>>a[i][0]>>a[i][1]>>a[i][2]; a[i][3]=1; } rep(i,5010)rep(j,15010) dp[i][j]=LLINF; dp[0][0]=0; rep(i,n){ rep(j,p+1){ if(dp[i][j]==LLINF) continue; rep(k,4){ chmin(dp[i+1][j+k],dp[i][j]+a[i][k]); } } } cout<<(double)dp[n][p]/(double)n<