#include <bits/stdc++.h>
using namespace std;
struct dat {
  long long scm, scl, tm, tl;
  long double pro;
  bool operator<(dat a) const {
    return tl * 1e6 * (1 - pro) * a.pro < a.tl * 1e6 * (1 - a.pro) * pro;
  }
} plm[1005];
pair<long double, long double> dp[1005][1561];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    long long x1, x2, t1, t2;
    long double p;
    cin >> x1 >> x2 >> t1 >> t2 >> p;
    plm[i].scm = x1;
    plm[i].scl = x2;
    plm[i].tm = t1;
    plm[i].tl = t2;
    plm[i].pro = 1 - p;
  }
  sort(plm, plm + n);
  dp[0][0] = make_pair(0, 0);
  for (int i = 0; i <= t; i++) dp[0][i] = make_pair(0, 0);
  dp[0][(int)plm[0].tm] = make_pair(plm[0].scm * 1e6, -plm[0].tm * 1e6);
  dp[0][(int)plm[0].tl + plm[0].tm] =
      make_pair(plm[0].scm * 1e6 + plm[0].scl * 1e6 * plm[0].pro,
                -plm[0].tm * 1e6 - plm[0].tl * 1e6 * plm[0].pro);
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= t; j++) {
      dp[i][j] = dp[i - 1][j];
      long double p = plm[i].pro;
      long long x1 = plm[i].scm, x2 = plm[i].scl, t1 = plm[i].tm,
                t2 = plm[i].tl;
      if (t1 <= j) {
        long double la1 = dp[i - 1][j - t1].first,
                    la2 = -dp[i - 1][j - t1].second;
        dp[i][j] = max(dp[i][j], make_pair(la1 + x1 * 1e6, -la2 - t1 * 1e6));
      }
      if (t1 + t2 <= j) {
        long double la1 = dp[i - 1][j - t1 - t2].first,
                    la2 = -dp[i - 1][j - t1 - t2].second;
        dp[i][j] =
            max(dp[i][j], make_pair(la1 + x1 * 1e6 + x2 * 1e6 * p,
                                    -p * j * 1e6 - (1 - p) * (t1 * 1e6 + la2)));
      }
    }
  }
  pair<long double, long double> res = make_pair(0, 0);
  for (int i = 0; i <= t; i++) {
    res = max(res, dp[n - 1][i]);
  }
  cout << fixed << setprecision(15) << res.first / 1e6 << " "
       << -res.second / 1e6;
}
