#include <bits/stdc++.h>
using namespace std;
const long long tp = 1000000;
struct dp {
  long long s;
  double t;
} f[1600], ans;
struct aa {
  long long t1, t2, s1, s2, p;
  double pp;
} a[1010];
int n, tot;
int cmp(aa x, aa y) {
  if (x.t2 * x.p * tp + y.t2 * x.p * y.p < y.t2 * y.p * tp + x.t2 * x.p * y.p) {
    return 1;
  }
  return 0;
}
void updata(int now, long long s, double t) {
  if (f[now].s < s || (f[now].s == s && f[now].t > t)) {
    f[now].s = s;
    f[now].t = t;
  }
  if (ans.s < f[now].s || (ans.s == f[now].s && f[now].t < ans.t)) {
    ans = f[now];
  }
}
int main() {
  long long t1, t2, s1, s2, p;
  double pp;
  scanf("%d%d", &n, &tot);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld%lld%lld%lf", &s1, &s2, &t1, &t2, &pp);
    p = (int)(pp * 1000000 + 0.5);
    s1 = s1 * tp;
    a[i].s1 = s1;
    a[i].s2 = s2;
    a[i].t1 = t1;
    a[i].t2 = t2;
    a[i].pp = pp;
    a[i].p = p;
  }
  sort(a, a + n, cmp);
  for (int i = 0; i < n; i++) {
    for (int j = tot; j >= 0; j--) {
      if (j + a[i].t1 <= tot) {
        updata(j + a[i].t1, f[j].s + a[i].s1, f[j].t + a[i].t1);
      }
      if (j + a[i].t1 + a[i].t2 <= tot) {
        updata(j + a[i].t1 + a[i].t2,
               f[j].s + a[i].s1 + a[i].s2 * (tp - a[i].p),
               (f[j].t + a[i].t1) * a[i].pp +
                   (j + a[i].t1 + a[i].t2) * (1.0 - a[i].pp));
      }
    }
  }
  printf("%.10lf %.10lf\n", (double)ans.s / tp, ans.t);
  return 0;
}
