#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000");
using namespace std;
long double smallscore[1008], bigscore[1008], smalltime[1008], bigtime[1008];
double probfail[1008];
pair<long double, pair<long double, long double> > dp[1008][1562];
int id[1008];
bool cmp(int x, int y) {
  int i = x, j = y;
  return probfail[j] * bigtime[j] + probfail[i] * probfail[j] * bigtime[i] >
         probfail[i] * bigtime[i] + probfail[j] * probfail[i] * bigtime[j];
}
pair<long double, pair<long double, long double> > maxa(
    pair<long double, pair<long double, long double> > a,
    pair<long double, pair<long double, long double> > b) {
  if (a.first != b.first) return max(a, b);
  if (a.second.first + a.second.second < b.second.first + b.second.second)
    return a;
  return b;
}
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 1; i <= n; i++) {
    cin >> smallscore[i] >> bigscore[i] >> smalltime[i] >> bigtime[i] >>
        probfail[i];
    id[i] = i;
  }
  dp[1][t] = make_pair(0, make_pair(0, 0));
  sort(id + 1, id + n + 1, cmp);
  for (int ii = 1; ii <= 1 + n; ii++) {
    int i = id[ii];
    for (int j = t; j >= 0; j--) {
      dp[ii][j] = maxa(dp[ii][j], dp[ii][j + 1]);
      dp[ii + 1][j] = maxa(dp[ii][j], dp[ii + 1][j]);
      if (ii == n + 1) continue;
      pair<long double, pair<long double, long double> > tem = dp[ii][j];
      tem = make_pair(dp[ii][j].first + smallscore[i],
                      make_pair(dp[ii][j].second.first + smalltime[i],
                                dp[ii][j].second.second + smalltime[i]));
      if (j >= smalltime[i])
        dp[ii + 1][j - (int)smalltime[i]] =
            maxa(dp[ii + 1][j - (int)smalltime[i]], tem);
      if (j >= smalltime[i] + bigtime[i]) {
        pair<long double, long double> jk, kl = dp[ii][j].second;
        jk = make_pair(
            kl.first + smalltime[i] + bigtime[i],
            (kl.second + smalltime[i]) * (probfail[i]) +
                (kl.first + smalltime[i] + bigtime[i]) * (1 - probfail[i]));
        tem = make_pair(
            dp[ii][j].first + smallscore[i] + bigscore[i] * (1 - probfail[i]),
            jk);
        dp[ii + 1][j - (int)smalltime[i] - (int)bigtime[i]] =
            maxa(dp[ii + 1][j - (int)smalltime[i] - (int)bigtime[i]], tem);
      }
    }
  }
  cout << setprecision(11);
  cout.setf(ios::fixed, ios::floatfield);
  n++;
  cout << dp[n][0].first << " " << dp[n][0].second.second;
  return 0;
}
