#include <bits/stdc++.h>
using namespace std;
struct prob {
  int ssc, lsc, st, lt;
  long double pos;
};
bool cmp(const prob &a, const prob &b) {
  return a.pos * a.lt * (1 - b.pos) < b.pos * b.lt * (1 - a.pos);
}
prob a[2005];
struct State {
  long double pts, times;
  State small(prob a) { return (State){pts + a.ssc, times + a.st}; }
  State large(prob a, int T) {
    return (State){pts + a.ssc + (1 - a.pos) * a.lsc,
                   a.st + a.pos * times + (1 - a.pos) * (a.lt + T)};
  }
  bool operator<(const State &a) const {
    if (fabs(pts - a.pts) > 1e-8) return pts < a.pts;
    return times > a.times;
  }
};
State f[2000];
int n, t;
int main() {
  scanf("%d%d", &n, &t);
  for (int i = (1); i <= (int)n; i++) {
    double tmp;
    scanf("%d%d", &a[i].ssc, &a[i].lsc),
        scanf("%d%d%lf", &a[i].st, &a[i].lt, &tmp);
    a[i].pos = tmp;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = (1); i <= (int)n; i++)
    for (int j = t; j >= 0; j--) {
      if (j >= a[i].st) f[j] = max(f[j], f[j - a[i].st].small(a[i]));
      if (j >= a[i].st + a[i].lt)
        f[j] = max(f[j],
                   f[j - a[i].st - a[i].lt].large(a[i], j - a[i].st - a[i].lt));
    }
  State ans = (State){0, 0};
  for (int j = (0); j <= (int)t; j++) ans = max(ans, f[j]);
  printf("%.15lf %.15lf", (double)ans.pts, (double)ans.times);
}
