#include <bits/stdc++.h>
using namespace std;
const int N = 1024, T = 1700;
const long double eps = 1e-8;
struct restype {
  long double v, t;
  void update(restype b) {
    if (b.v > v)
      v = b.v, t = b.t;
    else if (abs(b.v - v) < eps && b.t < t)
      t = b.t;
  }
} f[N][T];
int n, maxt;
struct item {
  pair<int, int> s, t;
  long double p;
  long double v;
} I[N];
bool operator<(const item &a, const item &b) { return a.v < b.v; }
int main() {
  scanf("%d%d", &n, &maxt);
  for (int i = 1; i <= n; ++i) {
    double d;
    scanf("%d%d%d%d%lf", &I[i].s.first, &I[i].s.second, &I[i].t.first,
          &I[i].t.second, &d);
    I[i].p = d;
    if (d == 1)
      I[i].v = 1e300;
    else
      I[i].v = I[i].t.second * d / (1 - d);
  }
  sort(I + 1, I + 1 + n);
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= maxt; ++j) {
      f[i + 1][j].update(f[i][j]);
      if (j + I[i].t.first <= maxt)
        f[i + 1][j + I[i].t.first].update(
            (restype){f[i][j].v + I[i].s.first, f[i][j].t + I[i].t.first});
      if (j + I[i].t.first + I[i].t.second <= maxt)
        f[i + 1][j + I[i].t.first + I[i].t.second].update(
            (restype){f[i][j].v + I[i].s.first + (1 - I[i].p) * I[i].s.second,
                      I[i].p * (I[i].t.first + f[i][j].t) +
                          (1 - I[i].p) * (I[i].t.first + j + I[i].t.second)});
    }
  }
  restype res;
  res.v = 0;
  res.t = 0;
  for (int j = 0; j <= maxt; ++j) res.update(f[n + 1][j]);
  printf("%.12f %.12f\n", double(res.v), double(res.t));
  return 0;
}
