#include <bits/stdc++.h>
inline void out(long double x) {
  double tmp = x;
  printf("%.10lf", tmp);
};
int n, m;
int s1[1005], s2[1005], t1[1005], t2[1005];
long double fail[1005];
inline bool cmp(int x, int y) {
  long double a1 = t2[x], a2 = t2[y], f1 = fail[x], f2 = fail[y];
  return a2 * (f2 - f1 * f2) + a1 * (f1 * f2 - f1) < 0;
};
long double f[1005][1565];
long double g[1005][1565];
inline void pre() {
  int i, j;
  for (i = 1; i < n; i++) {
    for (j = i + 1; j <= n; j++) {
      if (cmp(i, j)) {
        std::swap(s1[i], s1[j]);
        std::swap(s2[i], s2[j]);
        std::swap(t1[i], t1[j]);
        std::swap(t2[i], t2[j]);
        std::swap(fail[i], fail[j]);
      };
    };
  };
};
int main() {
  scanf("%d%d", &n, &m);
  int i, j;
  for (i = 1; i <= n; i++) {
    double tmp;
    scanf("%d%d%d%d%lf", s1 + i, s2 + i, t1 + i, t2 + i, &tmp);
    fail[i] = tmp;
  };
  pre();
  for (i = 1; i <= n; i++) {
    memcpy(f[i], f[i - 1], sizeof(f[i]));
    memcpy(g[i], g[i - 1], sizeof(g[i]));
    int t = t1[i];
    long double e = s1[i];
    for (j = m - t; j >= 0; j--) {
      long double tmp = f[i - 1][j] + e;
      long double tmp1 = g[i - 1][j] + t;
      if (tmp > f[i][j + t]) {
        f[i][j + t] = tmp;
        g[i][j + t] = tmp1;
      } else if (tmp == f[i][j + t] && tmp1 < g[i][j + t]) {
        g[i][j + t] = tmp1;
      };
    };
    t = t1[i] + t2[i];
    e = s1[i] + s2[i] * (1.0 - fail[i]);
    for (j = m - t; j >= 0; j--) {
      long double tmp = f[i - 1][j] + e;
      long double tmp1 =
          fail[i] * (g[i - 1][j] + t1[i]) + (1.0 - fail[i]) * (j + t);
      if (tmp > f[i][j + t]) {
        f[i][j + t] = tmp;
        g[i][j + t] = tmp1;
      } else if (tmp == f[i][j + t] && tmp1 < g[i][j + t]) {
        g[i][j + t] = tmp1;
      };
    };
  };
  long double ans = 0;
  long double e = 0;
  for (i = 0; i <= m; i++) {
    if (f[n][i] > ans) {
      ans = f[n][i];
      e = g[n][i];
    } else if (f[n][i] == ans && g[n][i] < e) {
      e = g[n][i];
    };
  };
  out(ans);
  putchar(32);
  out(e);
}
