#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 10;
struct node {
  int ss, sl, ts, tl;
  double p;
  bool operator<(const node &r) const {
    return tl * p * (1 - r.p) < r.tl * r.p * (1 - p);
  }
} a[MAXN];
node min(const node &a, const node &b) { return a < b ? a : b; }
int n, maxt;
pair<long double, double> f[MAXN * 2];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> maxt;
  for (int i = 1; i <= n; ++i)
    cin >> a[i].ss >> a[i].sl >> a[i].ts >> a[i].tl >> a[i].p;
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= maxt + 10; ++i) f[i].first = 1e18;
  f[0].first = f[0].second = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = maxt; j >= 0; --j) {
      long double x = f[j].first, 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 <= maxt)
        f[j + ts] = min(f[j + ts], pair<long double, double>(x - ss, y + ts));
      if (j + ts + tl <= maxt)
        f[j + ts + tl] = min(
            f[j + ts + tl],
            pair<long double, double>(x - ss - 1.0 * sl * (1.0 - p),
                                      (y + ts) * p + (j + ts + tl) * (1 - p)));
    }
  pair<long double, double> ans = pair<long double, double>(1e18, 1e9);
  for (int i = 0; i <= maxt; ++i) ans = min(ans, f[i]);
  printf("%.9lf %.9lf\n", (double)-ans.first, ans.second);
  return 0;
}
