#include <bits/stdc++.h>
using namespace std;
int n, t;
pair<long double, long double> f[1565], ans;
struct prob {
  int ss, sl, ts, tl;
  long double p;
} a[1005];
inline pair<long double, long double> Max(
    const pair<long double, long double> &x,
    const pair<long double, long double> &y) {
  return x.first - y.first > 1e-10     ? x
         : y.first - x.first > 1e-10   ? y
         : y.second - x.second > 1e-10 ? x
                                       : y;
}
int main() {
  cin >> n >> t;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].ss >> a[i].sl >> a[i].ts >> a[i].tl >> a[i].p;
    a[i].p *= 1e6;
  }
  sort(a + 1, a + n + 1, [](const prob &x, const prob &y) {
    return x.tl * x.p * (1e6 - y.p) < y.tl * y.p * (1e6 - x.p);
  });
  for (int i = 1; i <= n; i++) {
    for (int j = t; j; j--) {
      if (a[i].ts <= j)
        f[j] = Max(f[j], pair<long double, long double>(
                             f[j - a[i].ts].first + a[i].ss,
                             f[j - a[i].ts].second + a[i].ts * 1e6));
      if (a[i].ts + a[i].tl <= j)
        f[j] =
            Max(f[j],
                pair<long double, long double>(
                    f[j - a[i].ts - a[i].tl].first + a[i].ss +
                        (1e6 - a[i].p) * a[i].sl / 1e6,
                    a[i].p * (f[j - a[i].ts - a[i].tl].second + a[i].ts * 1e6) /
                            1e6 +
                        (1e6 - a[i].p) * j));
      if (i == n) ans = Max(ans, f[j]);
    }
  }
  cout << fixed << setprecision(10) << ans.first << ' ' << ans.second / 1e6;
  return 0;
}
