#include <bits/stdc++.h>
using namespace std;
int Read() {
  char c;
  while (c = getchar(), (c != '-') && (c < '0' || c > '9'))
    ;
  bool neg = (c == '-');
  int ret = (neg ? 0 : c - 48);
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + c - 48;
  return neg ? -ret : ret;
}
const int MAXN = 1005, MAXT = 1590;
struct Task {
  int ss, sl, ts, tl;
  long double p;
} a[MAXN];
int N, T;
pair<long double, long double> dp[MAXT];
bool cmp(Task x, Task y) {
  return y.p * x.tl * (1 - x.p) < x.p * y.tl * (1 - y.p);
}
void init() {
  scanf("%d%d", &N, &T);
  for (int i = 1; i <= N; i++) {
    double f;
    scanf("%d%d%d%d%lf", &a[i].ss, &a[i].sl, &a[i].ts, &a[i].tl, &f);
    a[i].p = 1.0 - f;
  }
  sort(a + 1, a + N + 1, cmp);
}
void work() {
  for (int i = 1; i <= N; i++)
    for (int j = T; j >= a[i].ts; j--) {
      if (make_pair(dp[j - a[i].ts].first - a[i].ss,
                    dp[j - a[i].ts].second + a[i].ts) < dp[j])
        dp[j] = make_pair(dp[j - a[i].ts].first - a[i].ss,
                          dp[j - a[i].ts].second + a[i].ts);
      if (j >= a[i].ts + a[i].tl) {
        long double score = dp[j - a[i].ts - a[i].tl].first - a[i].ss -
                            a[i].p * a[i].sl,
                    time = a[i].p * j +
                           (1.0 - a[i].p) *
                               (dp[j - a[i].ts - a[i].tl].second + a[i].ts);
        if (make_pair(score, time) < dp[j]) dp[j] = make_pair(score, time);
      }
    }
  pair<long double, long double> ans(0, 0);
  for (int i = 0; i <= T; i++)
    if (dp[i] < ans) ans = dp[i];
  printf("%.10f %.10f\n", (double)-ans.first, (double)ans.second);
}
int main() {
  init();
  work();
  return 0;
}
