#include <bits/stdc++.h>
using namespace std;
struct problem {
  long long ts, tl, ss, sl, p;
} pro[1005];
pair<long long, double> f[1005][1566];
int n, t;
bool cmp(problem a, problem b) {
  return a.tl * a.p * (1000000 - b.p) < b.tl * b.p * (1000000 - a.p);
}
bool better(pair<long long, double> &a, pair<long long, double> &b) {
  if (a.first != b.first) return a.first > b.first;
  return a.second < b.second;
}
void dp() {
  for (int i = (0); i <= (n + 1); i++)
    for (int j = (0); j <= (t); j++) f[i][j].first = -1;
  f[1][0] = make_pair(0, 0);
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (t); j++)
      if (f[i][j].first > -1) {
        if (better(f[i][j], f[i + 1][j])) f[i + 1][j] = f[i][j];
        pair<long long, double> P;
        long long nj;
        if (j + pro[i].ts <= t) {
          nj = j + pro[i].ts;
          P = make_pair(f[i][j].first + pro[i].ss,
                        f[i][j].second + pro[i].ts * 1000000);
          if (better(P, f[i + 1][nj])) f[i + 1][nj] = P;
        }
        if (j + pro[i].ts + pro[i].tl <= t) {
          nj = j + pro[i].ts + pro[i].tl;
          P.first =
              f[i][j].first + pro[i].ss + pro[i].sl * (1000000 - pro[i].p);
          P.second = pro[i].ts * 1000000 +
                     (1000000 - pro[i].p) * (pro[i].tl + j) +
                     f[i][j].second * pro[i].p / 1.0 / 1000000;
          if (better(P, f[i + 1][nj])) f[i + 1][nj] = P;
        }
      }
  pair<long long, double> res = make_pair(0, 0);
  for (int j = (0); j <= (t); j++)
    if (better(f[n + 1][j], res)) {
      res = f[n + 1][j];
    }
  printf("%.10lf %.10lf\n", res.first / 1000000.0, res.second / 1000000.0);
}
long long str_ll(string &s) {
  long long x = 0;
  int pos = -1;
  for (int i = 0; i < (s.length()); i++) {
    if (s[i] == '.') {
      pos = i + 1;
    } else
      x = x * 10 + s[i] - '0';
  }
  if (pos != -1)
    for (int i = 0; i < (6 - s.length() + pos); i++) x = x * 10;
  return x;
}
int main() {
  cin >> n >> t;
  for (int i = (1); i <= (n); i++) {
    double p;
    cin >> pro[i].ss >> pro[i].sl >> pro[i].ts >> pro[i].tl >> p;
    pro[i].ss *= 1000000;
    pro[i].p = (p * 1000000 + 0.5);
  }
  sort(pro + 1, pro + n + 1, cmp);
  dp();
  return 0;
}
