#include <bits/stdc++.h>
using namespace std;
const int N = 1010, T = 2020;
struct P {
  int s[2], t[2];
  long double f;
  inline void read() { scanf("%d%d%d%d%lf", &s[0], &s[1], &t[0], &t[1], &f); }
  inline long double operator-(const P& o) const {
    return (1 - o.f) * (t[1] + o.t[1]) + (1 - f) * o.f * t[1];
  }
  inline bool operator<(const P& o) const { return *this - o < o - *this; }
};
P p[N];
pair<long double, long double> dp[N][T];
int n, t;
int main() {
  while (scanf("%d%d", &n, &t) == 2) {
    for (int i = 1; i <= (n); ++i) p[i].read();
    sort(p + 1, p + 1 + n);
    for (int i = 0; i < (n + 1); ++i)
      for (int j = 0; j < (t + 1); ++j)
        dp[i][j] = pair<long double, long double>(0.0, 0.0);
    for (int i = 1; i <= (n); ++i)
      for (int j = 0; j < (t + 1); ++j) {
        dp[i][j] = max(dp[i][j], dp[i - 1][j]);
        if (j >= p[i].t[0]) {
          const pair<long double, long double>& u = dp[i - 1][j - p[i].t[0]];
          dp[i][j] =
              max(dp[i][j], pair<long double, long double>(
                                u.first + p[i].s[0], u.second - p[i].t[0]));
        }
        if (j >= p[i].t[0] + p[i].t[1]) {
          int tj = j - p[i].t[0] - p[i].t[1];
          const pair<long double, long double>& u = dp[i - 1][tj];
          dp[i][j] = max(dp[i][j],
                         pair<long double, long double>(
                             u.first + p[i].s[0] + p[i].s[1] * (1 - p[i].f),
                             p[i].f * (u.second - p[i].t[0]) +
                                 (1 - p[i].f) * (-tj - p[i].t[0] - p[i].t[1])));
        }
      }
    pair<long double, long double> ans(0.0, 0.0);
    for (int i = 0; i < (t + 1); ++i) ans = max(ans, dp[n][i]);
    printf("%.15f %.15f\n", (long double)ans.first, (long double)-ans.second);
  }
  return 0;
}
