#include <bits/stdc++.h>
inline int getint() {
  int x = 0, p = 1;
  char c = getchar();
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
struct DAT {
  int sS, sL, tS, tL;
  double p;
  DAT() {}
  DAT(int _sS, int _sL, int _tS, int _tL, double _p) {
    sS = _sS;
    sL = _sL;
    tS = _tS;
    tL = _tL;
    p = _p;
  }
  bool operator<(const DAT &b) const {
    long double x = p * 1.0 * tL / (1.0 - p);
    long double y = b.p * 1.0 * b.tL / (1.0 - b.p);
    return x < y;
  }
  void R() { scanf("%d%d%d%d%lf", &sS, &sL, &tS, &tL, &p); }
};
inline void upd(pair<long double, long double> &x,
                pair<long double, long double> y) {
  x = max(x, y);
}
const int maxn = 1600;
vector<DAT> dat;
int n, t;
pair<long double, long double> dp[maxn], odp[maxn];
int main() {
  n = getint();
  t = getint();
  for (int(i) = 0; (i) < (n); (i)++) {
    DAT u;
    u.R();
    dat.push_back(u);
  }
  sort(dat.begin(), dat.end());
  for (int(i) = 0; (i) < (t + 1); (i)++)
    dp[i] = make_pair(-10000000000000.0, -10000000000000.0);
  dp[0] = make_pair(0.0, 0.0);
  for (int(ii) = 0; (ii) < (n); (ii)++) {
    DAT u = dat[ii];
    for (int(i) = 0; (i) < (t + 1); (i)++) {
      odp[i] = dp[i];
      if (i >= u.tS)
        upd(dp[i], make_pair(odp[i - u.tS].first + 1.0 * u.sS,
                             odp[i - u.tS].second - 1.0 * u.tS));
      if (i >= u.tL + u.tS)
        upd(dp[i], make_pair(odp[i - u.tS - u.tL].first + 1.0 * u.sS +
                                 (1.0 - u.p) * u.sL,
                             u.p * (odp[i - u.tS - u.tL].second - 1.0 * u.tS) -
                                 (1.0 - u.p) * (1.0 * i)));
    }
  }
  pair<long double, long double> res(-10000000000000.0, -10000000000000.0);
  for (int(i) = 0; (i) < (t + 1); (i)++) upd(res, dp[i]);
  res.second *= -1.0;
  printf("%.12lf %.12lf\n", (double)res.first, (double)res.second);
  return 0;
}
