#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
struct sl {
  int SC, LC, TS, TL;
  double p;
} a[1005];
struct csl {
  long double score, tim;
} f[1005][1561], ans;
double a1, a2, p;
int n, m, z, x, y;
inline bool cmp(sl x, sl y) {
  return x.TL * x.p * (1 - y.p) < y.TL * y.p * (1 - x.p);
}
inline csl Max(csl x, int l, int k, int t) {
  csl y;
  y.score = y.tim = 0;
  if (t == 1) {
    y.score = f[l - 1][k - a[l].TS].score + a[l].SC;
    y.tim = f[l - 1][k - a[l].TS].tim + a[l].TS;
  } else {
    y.score = f[l - 1][k - a[l].TS - a[l].TL].score + a[l].SC +
              a[l].LC * (1 - a[l].p);
    y.tim = a[l].p * (f[l - 1][k - a[l].TS - a[l].TL].tim + a[l].TS) +
            k * (1 - a[l].p);
  }
  if (x.score + eps < y.score ||
      (abs(x.score - y.score) < eps && x.tim > y.tim))
    return y;
  else
    return x;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d%d%d%lf", &a[i].SC, &a[i].LC, &a[i].TS, &a[i].TL, &a[i].p);
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      f[i][j] = f[i - 1][j];
      if (j >= a[i].TS) f[i][j] = Max(f[i][j], i, j, 1);
      if (j >= a[i].TS + a[i].TL) f[i][j] = Max(f[i][j], i, j, 2);
    }
  }
  for (int i = 0; i <= m; ++i)
    if (ans.score + eps < f[n][i].score ||
        (abs(ans.score - f[n][i].score) < eps && ans.tim > f[n][i].tim))
      ans = f[n][i];
  printf("%.10lf %.10lf", (double)ans.score, (double)ans.tim);
}
