#include using namespace std; #define pb push_back typedef long long ll; const ll INF = 1000000000000000000ll; const ll MOD = 1000000007ll; const double EPS = 1e-8; ll dp[5001][15001]; int main(void) { //ios_base::sync_with_stdio(false); //cin.tie(0); int n, p; cin >> n >> p; vector a, b, c; a.pb(0); b.pb(0); c.pb(0); for(int i=0; i> ta >> tb >> tc; a.pb(ta); b.pb(tb); c.pb(tc); } for(int i=1; i<=n; i++){ for(int j=p; j>=0; j--){ dp[i][j] = dp[i-1][j] + a[i]; if(j-1 >= 0){ dp[i][j] = min(dp[i][j], dp[i-1][j-1] + b[i]); } if(j-2 >= 0){ dp[i][j] = min(dp[i][j], dp[i-1][j-2] + c[i]); } if(j-3 >= 0){ dp[i][j] = min(dp[i][j], dp[i-1][j-3] + 1); } } } printf("%.8f\n", 1.0 * dp[n][p] / n); return 0; }