// #includes {{{ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // }}} // pre-written code {{{ #define REP(i,n) for(int i=0;i<(int)(n);++i) #define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i) #define LET(x,a) __typeof(a) x(a) //#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i) #define ALL(c) (c).begin(), (c).end() #define MP make_pair #define EXIST(e,s) ((s).find(e)!=(s).end()) #define RESET(a) memset((a),0,sizeof(a)) #define SET(a) memset((a),-1,sizeof(a)) #define PB push_back #define DEC(it,command) __typeof(command) it=command //debug #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; #define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl; const int INF=0x3f3f3f3f; typedef long long Int; typedef unsigned long long uInt; #ifdef __MINGW32__ typedef double rn; #else typedef double rn; #endif typedef pair pii; /* #ifdef MYDEBUG #include"debug.h" #include"print.h" #endif */ // }}} int N,P; int t[5050][4]; rn dp[2][15050]; const rn inf = 1.0L/0.0L; int main(){ cin>>N>>P; REP(i,N)cin>>t[i][0]>>t[i][1]>>t[i][2],t[i][3]=1; for(int p=0;p<=P;p++){ dp[0][p] = (p==0)?0.0L:inf; } REP(i,N){ int from = i%2, to = (i+1)%2; for(int p=0;p<=P;p++)dp[to][p] = inf; for(int p=0;p<=P;p++){ for(int j=0;j<=3;j++){ if(p-j<0)continue; dp[to][p] = min(dp[to][p],dp[from][p-j]+t[i][j]); } } } printf("%.10lf\n",dp[N%2][P]/N); return 0; }