#include <bits/stdc++.h>
using namespace std;
const int N = 1005, T = 1565;
const long long base = 1000000;
struct _two {
  long long a;
  long double b;
} f[T];
struct _node {
  int ss, sl, ts, tl, pf;
} a[N];
bool operator<(const _node &x, const _node &y) {
  return (long double)x.pf * (base - y.pf) * x.tl <
         (long double)y.pf * (base - x.pf) * y.tl;
}
int n, t;
void Init() {
  scanf("%d%d", &n, &t);
  double x;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d%lf", &a[i].ss, &a[i].sl, &a[i].ts, &a[i].tl, &x);
    a[i].pf = (int)(x * 1e6 + 1e-6);
  }
  sort(a + 1, a + n + 1);
}
void Update(_two &x, long long v, long double t) {
  if (x.a == v && x.b > t || x.a < v) x = (_two){v, t};
}
void Work() {
  for (int i = 1; i <= t; i++) f[i].a = -1;
  for (int i = 1; i <= n; i++)
    for (int j = t; j >= 1; j--) {
      if (j >= a[i].ts)
        Update(f[j], f[j - a[i].ts].a + a[i].ss * base,
               f[j - a[i].ts].b + a[i].ts);
      if (j >= a[i].ts + a[i].tl)
        Update(f[j],
               f[j - a[i].ts - a[i].tl].a + a[i].ss * base +
                   a[i].sl * (base - a[i].pf),
               a[i].pf * 1e-6 * (f[j - a[i].ts - a[i].tl].b + a[i].ts) +
                   (1 - a[i].pf * 1e-6) * j);
    }
  for (int i = 1; i <= t; i++) Update(f[0], f[i].a, f[i].b);
  printf("%.18lf %.18lf\n", f[0].a * 1e-6, (double)f[0].b);
}
int main() {
  Init();
  Work();
  return 0;
}
