#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
const int maxt = 1561, maxn = 1000;
pair<long long, double> tmp[2][maxt], *d = tmp[0], *nd = tmp[1];
struct problem {
  int scoreSmall, scoreLarge, timeSmall, timeLarge;
  int probFail;
  void read() {
    double tmp;
    scanf("%d%d%d%d%lf", &scoreSmall, &scoreLarge, &timeSmall, &timeLarge,
          &tmp);
    probFail = (int)floor(1e6 * tmp + (1e-9));
  }
  inline bool operator<(const problem &p) const {
    return (long long)timeLarge * probFail * ((int)1e6 - p.probFail) <
           (long long)p.timeLarge * p.probFail * ((int)1e6 - probFail);
  }
} problems[maxn];
void update(pair<long long, double> &val, pair<long long, double> toupdate) {
  val = max(val, toupdate);
}
int main() {
  srand(rdtsc());
  int n, t;
  while (scanf("%d%d", &n, &t) >= 1) {
    for (int i = 0; i < n; i++) {
      problems[i].read();
    }
    sort(problems, problems + n);
    for (int i = 0; i <= t; i++) d[i] = make_pair(-1, 0);
    d[0] = make_pair(0, 0);
    for (int iter = 0; iter < n; iter++) {
      problem &current = problems[iter];
      for (int i = 0; i <= t; i++) nd[i] = d[i];
      for (int i = 0; i <= t; i++) {
        if (d[i].first == -1) continue;
        if (i + current.timeSmall <= t)
          update(nd[i + current.timeSmall],
                 make_pair(d[i].first + current.scoreSmall * (long long)1e6,
                           d[i].second - current.timeSmall));
        if (i + current.timeSmall + current.timeLarge <= t)
          update(
              nd[i + current.timeSmall + current.timeLarge],
              make_pair(
                  d[i].first + (long long)1e6 * current.scoreSmall +
                      current.scoreLarge * ((long long)1e6 - current.probFail),
                  (d[i].second - current.timeSmall) * current.probFail / 1e6 -
                      (1.0 - current.probFail / 1e6) *
                          (i + current.timeSmall + current.timeLarge)));
      }
      swap(d, nd);
    }
    pair<long long, double> cur = *max_element(d, d + t + 1);
    printf("%.18lf %.18lf\n", cur.first / 1e6, max(0.0, -cur.second));
  }
  return 0;
}
