#include <bits/stdc++.h>
using namespace std;
const int N = 2001;
const long double eps = 1e-16;
long double f[N];
long double ptme[N];
int n;
struct Problem {
  long double fail;
  int tmes, tmel;
  int scs, scl;
} p[N];
inline long double lfabs(long double y) { return y < 0 ? -y : y; }
int cmp(Problem A, Problem B) {
  return 1.0 * A.tmel * (A.fail) * (1.0 - B.fail) <
         1.0 * B.tmel * (B.fail) * (1.0 - A.fail);
}
long double ans, anst;
void update(int ind, long double nf, long double nt) {
  if (nf > f[ind] + eps) {
    f[ind] = nf;
    ptme[ind] = nt;
  } else if (lfabs(nf - f[ind]) < eps && nt < ptme[ind]) {
    ptme[ind] = nt;
  }
}
int t;
int main() {
  cin >> n >> t;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i].scs >> p[i].scl >> p[i].tmes >> p[i].tmel >> p[i].fail;
  }
  sort(p + 1, p + n + 1, cmp);
  f[0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = t; j >= 0; --j) {
      if (j + p[i].tmes <= t)
        update(j + p[i].tmes, f[j] + p[i].scs, ptme[j] + p[i].tmes);
      if (j + p[i].tmes + p[i].tmel <= t)
        update(j + p[i].tmes + p[i].tmel,
               f[j] + p[i].scs + (long double)(1 - p[i].fail) * p[i].scl,
               p[i].fail * ptme[j] +
                   (long double)(1 - p[i].fail) * (long double)(j + p[i].tmel) +
                   p[i].tmes);
    }
  }
  ans = anst = 0;
  for (int i = 0; i <= t; ++i) {
    if (f[i] > ans + eps) {
      ans = f[i];
      anst = ptme[i];
    } else if (lfabs(f[i] - ans) < eps && ptme[i] < anst) {
      anst = ptme[i];
    }
  }
  cout << fixed << setprecision(10) << ans << ' ' << anst << endl;
  return 0;
}
