#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1, c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f ^= 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return f ? x : -x;
}
int n, t;
pair<long double, long double> dp[2][1565];
int sS[1005], sL[1005];
int tS[1005], tL[1005];
double p[1005];
vector<pair<long double, int> > v;
void chkmin(pair<long double, long double>& x,
            pair<long double, long double> y) {
  if (y.first > x.first || (y.first == x.first && y.second < x.second)) x = y;
}
int main() {
  scanf("%d %d", &n, &t);
  for (int i = 0; i < (int)(n); ++i) {
    scanf("%d %d %d %d %lf", &sS[i], &sL[i], &tS[i], &tL[i], &p[i]);
    v.push_back(make_pair(tL[i] * p[i] / (1.0 - p[i]), i));
  }
  sort(v.begin(), v.end());
  int p1 = 0, p2 = 1;
  for (int i = 0; i < (int)(t + 1); ++i)
    dp[0][i] = dp[1][i] = make_pair(0, 1e18);
  dp[0][0] = make_pair(0, 0);
  for (int ii = 0; ii < (int)(n); ++ii) {
    int i = v[ii].second;
    for (int j = 0; j < (int)(t + 1); ++j) {
      chkmin(dp[p2][j], dp[p1][j]);
      if (j + tS[i] <= t)
        chkmin(dp[p2][j + tS[i]],
               make_pair(dp[p1][j].first + sS[i], dp[p1][j].second + tS[i]));
      if (j + tS[i] + tL[i] <= t)
        chkmin(dp[p2][j + tS[i] + tL[i]],
               make_pair(dp[p1][j].first + sS[i] + sL[i] * (1.0 - p[i]),
                         (dp[p1][j].second + tS[i]) * p[i] +
                             (j + tS[i] + tL[i]) * (1.0 - p[i])));
    }
    p1 ^= 1, p2 ^= 1;
    for (int j = 0; j < (int)(t + 1); ++j) dp[p2][j] = make_pair(0, 1e18);
  }
  pair<long double, long double> ans = make_pair(0, 1e18);
  for (int i = 0; i < (int)(t + 1); ++i) chkmin(ans, dp[p1][i]);
  printf("%.10lf %.10lf\n", (double)ans.first, (double)ans.second);
  return 0;
}
