#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const double eps = 1e-10;
const long long linf = 1e18 + 7;
const long long hh = 523;
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
double fail[1007];
long double dp[1007][1567], t[1007][1567];
int n, tt;
struct problem {
  int ss, sl, ts, tl;
  double fail;
} p[1007];
bool d1(problem a, problem b) {
  return a.tl * a.fail / (1 - a.fail) < b.tl * b.fail / (1 - b.fail);
}
int main() {
  scanf("%d%d", &n, &tt);
  for (int i = 0; i < n; i++) {
    scanf("%d%d%d%d%lf", &p[i].ss, &p[i].sl, &p[i].ts, &p[i].tl, &p[i].fail);
  }
  sort(p, p + n, d1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= tt; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][tt] = 0;
  t[0][tt] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= tt; j++) {
      if (dp[i][j] == -1) {
        continue;
      }
      if (j >= p[i].ts) {
        if (dp[i + 1][j - p[i].ts] < dp[i][j] + p[i].ss) {
          dp[i + 1][j - p[i].ts] = dp[i][j] + p[i].ss;
          t[i + 1][j - p[i].ts] = t[i][j] + p[i].ts;
        } else if (dp[i + 1][j - p[i].ts] == dp[i][j] + p[i].ss) {
          t[i + 1][j - p[i].ts] = min(t[i + 1][j - p[i].ts], t[i][j] + p[i].ts);
        }
      }
      if (j >= p[i].ts + p[i].tl) {
        if (dp[i + 1][j - p[i].ts - p[i].tl] <
            dp[i][j] + p[i].ss + p[i].sl * (1.0 - p[i].fail)) {
          dp[i + 1][j - p[i].ts - p[i].tl] =
              dp[i][j] + p[i].ss + p[i].sl * (1.0 - p[i].fail);
          t[i + 1][j - p[i].ts - p[i].tl] =
              p[i].ts + p[i].fail * t[i][j] +
              (1 - p[i].fail) * (p[i].tl + (tt - j));
        } else if (dp[i + 1][j - p[i].ts - p[i].tl] ==
                   dp[i][j] + p[i].ss + p[i].sl * (1.0 - p[i].fail)) {
          t[i + 1][j - p[i].ts - p[i].tl] =
              min(t[i + 1][j - p[i].ts - p[i].tl],
                  p[i].ts + p[i].fail * t[i][j] +
                      (1 - p[i].fail) * (p[i].tl + (tt - j)));
        }
      }
      if (dp[i + 1][j] < dp[i][j]) {
        dp[i + 1][j] = dp[i][j];
        t[i + 1][j] = t[i][j];
      } else if (dp[i + 1][j] == dp[i][j]) {
        t[i + 1][j] = min(t[i + 1][j], t[i][j]);
      }
    }
  }
  long double mx = 0, ans = linf;
  for (int i = 0; i <= tt; i++) {
    if (dp[n][i] > mx) {
      mx = dp[n][i];
      ans = t[n][i];
    } else if (dp[n][i] == mx) {
      ans = min(ans, t[n][i]);
    }
  }
  cout << fixed << setprecision(10) << mx << " " << ans << endl;
  return 0;
}
