#include using namespace std; int main() { int N, P; cin >> N >> P; vector a(N), b(N), c(N); for(int i = 0; i < N; ++i) cin >> a[i] >> b[i] >> c[i]; vector cur(P+1, INT_MAX); vector nex(P+1, INT_MAX); cur[0] = 0; for(int i = 0; i < N; ++i) { fill(nex.begin(), nex.end(), INT_MAX); for(int j = P; j >= 0; --j) { if(j >= 0 && cur[j-0] != INT_MAX) nex[j] = min(nex[j], cur[j-0]+a[i]); if(j >= 1 && cur[j-1] != INT_MAX) nex[j] = min(nex[j], cur[j-1]+b[i]); if(j >= 2 && cur[j-2] != INT_MAX) nex[j] = min(nex[j], cur[j-2]+c[i]); if(j >= 3 && cur[j-3] != INT_MAX) nex[j] = min(nex[j], cur[j-3]+1); } cur.swap(nex); } cout << fixed << setprecision(12) << (double)cur[P]/N << endl; return 0; }