#include <bits/stdc++.h>
using namespace std;
const int MAX = 2000 + 10;
const long double One = 1e6;
long double EPS = 1e-9;
struct pro {
  int sp, bp, st, bt;
  long double failp;
} d[MAX];
struct Case {
  long double point, penalty;
  Case() {
    point = -1e10;
    penalty = 1e10;
  }
  Case(long double a, long double b) {
    point = a;
    penalty = b;
  }
} f[MAX][MAX];
int operator<(const Case& a, const Case& b) {
  if (abs(a.point - b.point) > EPS)
    return a.point < b.point;
  else
    return a.penalty > b.penalty;
}
int operator<(const pro& a, const pro& b) {
  return a.bt * (1 - a.failp) * b.failp + (a.bt + b.bt) * (1 - b.failp) <
         b.bt * (1 - b.failp) * a.failp + (a.bt + b.bt) * (1 - a.failp);
}
int n, t;
int main() {
  int i, j;
  scanf("%d%d", &n, &t);
  for ((i) = (1); (i) <= (n); ++(i))
    scanf("%d%d%d%d", &d[i].sp, &d[i].bp, &d[i].st, &d[i].bt),
        cin >> d[i].failp;
  sort(d + 1, d + n + 1);
  f[0][0] = Case(0, 0);
  Case ans;
  for (i = 1; i <= n; ++i)
    for (j = 0; j <= t; ++j) {
      f[i][j] = max(f[i][j], f[i - 1][j]);
      if (j + d[i].st > t) continue;
      f[i][j + d[i].st] =
          max(f[i][j + d[i].st],
              Case(f[i - 1][j].point + d[i].sp, f[i - 1][j].penalty + d[i].st));
      if (j + d[i].st + d[i].bt > t) continue;
      f[i][j + d[i].st + d[i].bt] =
          max(f[i][j + d[i].st + d[i].bt],
              Case(f[i - 1][j].point + d[i].sp + d[i].bp * (1 - d[i].failp),
                   f[i - 1][j].penalty * d[i].failp + d[i].st +
                       (j + d[i].bt) * (1 - d[i].failp)));
    }
  for (j = 0; j <= t; ++j) ans = max(ans, f[n][j]);
  cout.setf(ios::fixed);
  cout << setprecision(9) << ans.point << " " << ans.penalty << endl;
  return 0;
}
