#include <bits/stdc++.h>
using namespace std;
const long double inf = 100000.0;
const int N = 2010;
struct nd {
  int c1, c2, t1, t2, p2;
  long double p;
} a[N];
int h[N][N], n, m;
long long f[N][N];
long double g[N][N];
bool cmp(nd x, nd y) {
  return x.p * (long double)y.t2 - x.p * y.p * (long double)y.t2 >
         y.p * (long double)x.t2 - x.p * y.p * (long double)x.t2;
}
int main() {
  int i, j, k, p, nxt;
  double x;
  long long mx;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d%d%d%d%lf", &a[i].c1, &a[i].c2, &a[i].t1, &a[i].t2, &x);
    a[i].p = 1 - x;
    a[i].p2 = (int)(a[i].p * (long double)1000000 + 0.00001);
  }
  sort(a + 1, a + n + 1, cmp);
  f[0][0] = 0;
  for (i = 1; i <= n; i++)
    for (j = 0; j <= m; j++) {
      f[i][j] = f[i - 1][j];
      if (j >= a[i].t1)
        f[i][j] = max(f[i][j], f[i - 1][j - a[i].t1] +
                                   (long long)1000000 * (long long)a[i].c1);
      if (j >= a[i].t1 + a[i].t2)
        f[i][j] = max(f[i][j], f[i - 1][j - a[i].t1 - a[i].t2] +
                                   (long long)a[i].c1 * (long long)1000000 +
                                   a[i].p2 * (long long)a[i].c2);
    }
  p = 0;
  mx = 0;
  for (i = 0; i <= m; i++)
    if (mx < f[n][i]) mx = f[n][i], p = i;
  double out = (long double)mx / 1000000.0;
  printf("%.10f ", out);
  for (i = 0; i <= n; i++)
    for (j = 0; j <= m; j++) g[i][j] = inf;
  g[0][0] = 0;
  h[0][0] = 0;
  for (i = 1; i <= n; i++)
    for (j = 0; j <= m; j++) {
      if (!(f[i][j] - f[i - 1][j])) {
        g[i][j] = g[i - 1][j];
        h[i][j] = h[i - 1][j];
      }
      if ((j >= a[i].t1) && (!(f[i][j] - f[i - 1][j - a[i].t1] -
                               (long long)1000000 * (long long)a[i].c1))) {
        if (g[i][j] > g[i - 1][j - a[i].t1] + a[i].t1) {
          g[i][j] = g[i - 1][j - a[i].t1] + a[i].t1;
          h[i][j] = h[i - 1][j - a[i].t1];
        }
      }
      nxt = j - a[i].t1 - a[i].t2;
      if ((j >= a[i].t1 + a[i].t2) &&
          (!(f[i][j] - f[i - 1][nxt] - (long long)1000000 * (long long)a[i].c1 -
             a[i].p2 * (long long)a[i].c2))) {
        if (g[i][j] > (1 - a[i].p) * (g[i - 1][nxt] - (nxt - h[i - 1][nxt])) +
                          nxt - h[i - 1][nxt] + a[i].t1 +
                          a[i].p * (a[i].t2 + h[i - 1][nxt])) {
          g[i][j] = (1 - a[i].p) * (g[i - 1][nxt] - (nxt - h[i - 1][nxt])) +
                    nxt - h[i - 1][nxt] + a[i].t1 +
                    a[i].p * (a[i].t2 + h[i - 1][nxt]);
          h[i][j] = h[i - 1][nxt] + a[i].t2;
        }
      }
    }
  out = inf;
  for (i = 0; i <= m; i++)
    if (!(mx - f[n][i])) out = min(out, (double)g[n][i]);
  printf("%.10f\n", out);
  return 0;
}
