#include <bits/stdc++.h>
using namespace std;
class prob {
 public:
  long long ssmall, slarge, tsmall, tlarge, pfail;
  long double fpfail;
  void read() {
    double tmp;
    scanf("%lld%lld%lld%lld%lf", &ssmall, &slarge, &tsmall, &tlarge, &tmp);
    pfail = round(tmp * 1e6);
    pfail = 1000000 - pfail;
    fpfail = tmp;
  }
  bool operator<(const prob &t) const {
    long double t1 =
        (1 - t.fpfail) * (tlarge + t.tlarge) + (1 - fpfail) * t.fpfail * tlarge;
    long double t2 =
        (1 - fpfail) * (tlarge + t.tlarge) + (1 - t.fpfail) * fpfail * t.tlarge;
    return t1 < t2;
  }
} p[1010];
int n, t;
class dat {
 public:
  long long sco;
  double tim;
  dat() {}
  dat(long long t1, double t2) { sco = t1, tim = t2; }
  bool operator<(const dat &t) const {
    if (sco != t.sco) return sco < t.sco;
    return tim > t.tim;
  }
} dp[1010][1570];
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) p[i].read();
  sort(p + 1, p + n + 1);
  fill(dp[0] + 1, dp[0] + t + 1, dat(-1e18, 1600000));
  for (int i = 1; i <= n; i++) {
    copy(dp[i - 1], dp[i - 1] + t + 1, dp[i]);
    for (int j = 0; j + p[i].tsmall <= t; j++)
      dp[i][j + p[i].tsmall] = max(dp[i][j + p[i].tsmall],
                                   dat(dp[i - 1][j].sco + p[i].ssmall * 1000000,
                                       dp[i - 1][j].tim + p[i].tsmall));
    for (int j = 0; j + p[i].tsmall + p[i].tlarge <= t; j++)
      dp[i][j + p[i].tsmall + p[i].tlarge] =
          max(dp[i][j + p[i].tsmall + p[i].tlarge],
              dat(dp[i - 1][j].sco + p[i].ssmall * 1000000 +
                      p[i].slarge * p[i].pfail,
                  p[i].tsmall + (1 - p[i].fpfail) * (p[i].tlarge + j) +
                      p[i].fpfail * dp[i - 1][j].tim));
  }
  dat ans = dat(-1e18, 1600000);
  for (int i = 0; i <= t; i++) ans = max(ans, dp[n][i]);
  printf("%lld.%06lld %.10lf", ans.sco / 1000000, ans.sco % 1000000, ans.tim);
  return 0;
}
