#include <bits/stdc++.h>
inline int Get() {
  char ch;
  while ((ch = getchar()) < '0' || ch > '9')
    ;
  int Num = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9')
    Num = (Num << 3) + (Num << 1) + ch - '0';
  return Num;
}
const int N = 1e3 + 5;
const int M = 1600;
int n, m, gA[N], gB[N], tA[N], tB[N], id[N];
long double prob[N];
std ::pair<long double, long double> dp[N][M];
inline bool cmp(const int &a, const int &b) {
  return (1 - prob[b]) * prob[a] * tB[a] < (1 - prob[a]) * prob[b] * tB[b];
}
int main() {
  n = Get(), m = Get();
  for (int i = 1; i <= n; ++i) {
    gA[i] = Get(), gB[i] = Get(), tA[i] = Get(), tB[i] = Get();
    double res;
    scanf("%lf", &res);
    prob[i] = res;
  }
  for (int i = 1; i <= n; ++i) id[i] = i;
  std ::sort(id + 1, id + n + 1, cmp);
  for (int i = 1, k; k = id[i], i <= n; ++i)
    for (int j = m; j >= 0; --j) {
      std ::pair<long double, long double> nxt;
      dp[i][j] = dp[i - 1][j];
      if (j >= tA[k]) {
        nxt = std ::make_pair(dp[i - 1][j - tA[k]].first + gA[k],
                              dp[i - 1][j - tA[k]].second - tA[k]);
        dp[i][j] = std ::max(dp[i][j], nxt);
      }
      if (j >= tA[k] + tB[k]) {
        nxt.first =
            dp[i - 1][j - tA[k] - tB[k]].first + gA[k] + (1 - prob[k]) * gB[k];
        nxt.second = prob[k] * dp[i - 1][j - tA[k] - tB[k]].second -
                     (1 - prob[k]) * (j - tA[k]) - tA[k];
        dp[i][j] = std ::max(dp[i][j], nxt);
      }
    }
  std ::pair<long double, long double> ans = std ::make_pair(0, 0);
  for (int j = 0; j <= m; ++j) ans = std ::max(ans, dp[n][j]);
  printf("%.10lf %.10lf\n", (double)ans.first, -(double)ans.second);
}
