#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005, maxt = 1605;
const long double eps = 1e-9;
int t, n;
long double ans0, ans1;
long double f[maxt][2];
struct question {
  int a, b, s, t;
  long double p;
} c[maxn];
inline int cmpc(question x, question y) {
  return (1.0 - y.p) * (x.t + y.t) + y.p * (1.0 - x.p) * x.t <
         (1.0 - x.p) * (x.t + y.t) + x.p * (1.0 - y.p) * y.t;
}
inline int cmp(long double a, long double b) {
  return fabs(a - b) < eps ? 0 : (a < b ? -1 : 1);
}
inline void get(long double &a, long double &b, long double x, long double y) {
  if (cmp(a, x) == 0 && cmp(b, y) == 1) b = y;
  if (cmp(a, x) == -1) a = x, b = y;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) {
    double tmp;
    scanf("%d%d%d%d%lf", &c[i].a, &c[i].b, &c[i].s, &c[i].t, &tmp);
    c[i].p = (long double)tmp;
  }
  sort(c + 1, c + 1 + n, cmpc);
  for (int i = 0; i <= t; i++) f[i][0] = f[i][1] = (long double)0.0;
  for (int i = 1; i <= n; i++)
    for (int j = t; j >= c[i].s; j--) {
      get(f[j][0], f[j][1], f[j - c[i].s][0] + c[i].a,
          f[j - c[i].s][1] + c[i].s);
      if (j >= c[i].s + c[i].t)
        get(f[j][0], f[j][1],
            f[j - c[i].s - c[i].t][0] + c[i].a +
                ((long double)1.0 - c[i].p) * c[i].b,
            c[i].p * (f[j - c[i].s - c[i].t][1] + c[i].s) +
                ((long double)1.0 - c[i].p) * j);
    }
  for (int i = 0; i <= t; i++) get(ans0, ans1, f[i][0], f[i][1]);
  printf("%.10lf %.10lf\n", (double)ans0, (double)ans1);
  return 0;
}
