#include <bits/stdc++.h>
using namespace std;
struct Problem {
  int scoreSmall, scoreLarge, timeSmall, timeLarge, intProbFail;
  double probFail;
  void init() {
    scanf("%d%d%d%d%lf", &scoreSmall, &scoreLarge, &timeSmall, &timeLarge,
          &probFail);
    intProbFail = probFail * 1000000 + 0.5;
  }
  bool operator<(const Problem &rhs) const {
    return (1000000LL - rhs.intProbFail) * timeLarge * intProbFail <
           (1000000LL - intProbFail) * rhs.timeLarge * rhs.intProbFail;
  }
};
const int MAXT = 2000;
const long long INFLL = 1012345678901234567LL;
int n, T;
vector<Problem> problems;
pair<long long, double> dp[MAXT];
int main() {
  scanf("%d%d", &n, &T);
  problems = vector<Problem>(n);
  for (int i = (0); i < (n); i++) problems[i].init();
  sort(((problems).begin()), ((problems).end()));
  dp[0] = make_pair(0LL, 0);
  for (int i = (0); i < (T); i++) dp[i + 1] = make_pair(-INFLL, -1E100);
  for (int i = (0); i < (n); i++) {
    for (int j = T; j >= 0; j--) {
      int k;
      k = j - problems[i].timeSmall;
      if (k >= 0 && dp[k].first != -INFLL) {
        dp[j] = max(dp[j],
                    make_pair(dp[k].first + problems[i].scoreSmall * 1000000LL,
                              dp[k].second - problems[i].timeSmall));
      }
      k = j - problems[i].timeSmall - problems[i].timeLarge;
      if (k >= 0 && dp[k].first != -INFLL) {
        dp[j] = max(dp[j],
                    make_pair(dp[k].first + problems[i].scoreSmall * 1000000LL +
                                  problems[i].scoreLarge *
                                      (1000000LL - problems[i].intProbFail),
                              (dp[k].second - problems[i].timeSmall) *
                                      problems[i].probFail -
                                  j * (1 - problems[i].probFail)));
      }
    }
  }
  pair<long long, double> res = *max_element(dp, dp + T + 1);
  printf("%.16lf %.16lf\n", res.first / 1000000., -res.second);
  return 0;
}
