#include <bits/stdc++.h>
using namespace std;
struct bg {
  int ss, sl, ts, tl, pp;
  double p;
} a[1005];
int N, T;
pair<long long, double> f[2005];
void init() {
  scanf("%d%d", &N, &T);
  for (int i = 1; i <= N; i++)
    scanf("%d%d%d%d%lf", &a[i].ss, &a[i].sl, &a[i].ts, &a[i].tl, &a[i].p),
        a[i].pp = a[i].p * 1000000ll + 0.5;
  sort(a + 1, a + N + 1, [&](const bg& A, const bg& B) {
    return 1ll * A.tl * A.pp * (1000000ll - B.pp) <
           1ll * B.tl * B.pp * (1000000ll - A.pp);
  });
}
void doit() {
  memset(f, 63, sizeof(f)), f[0] = pair<long long, double>(0, 0);
  for (int i = 1; i <= N; i++)
    for (int j = T; j >= 0; j--) {
      long long x = f[j].first, pp = a[i].pp;
      double y = f[j].second, p = a[i].p;
      int ts = a[i].ts, tl = a[i].tl, ss = a[i].ss, sl = a[i].sl;
      if (j + ts <= T)
        f[j + ts] =
            min(f[j + ts], pair<long long, double>(x - ss * 1000000ll, y + ts));
      if (j + ts + tl <= T)
        f[j + ts + tl] = min(
            f[j + ts + tl],
            pair<long long, double>(x - ss * 1000000ll - sl * (1000000ll - pp),
                                    (y + ts) * p + (j + ts + tl) * (1 - p)));
    }
  pair<long long, double> ans = *min_element(f, f + T + 1);
  printf("%.9lf %.9lf\n", -ans.first / 1e6, ans.second);
}
int main() {
  init();
  doit();
  return 0;
}
