#include <bits/stdc++.h>
using namespace std;
inline void Fail() {
  printf("0");
  exit(0);
}
inline void Unique(vector<int> &v) {
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
}
inline int Get(vector<int> v, int x) {
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
const int maxn = 1005;
const int maxm = 1565;
const long double Eps = 1e-9;
int n, t;
int ss[maxn], sb[maxn], ts[maxn], tb[maxn], q[maxn];
long double fail[maxn];
long double g[maxn][maxm], f[maxn][maxm];
long double ans, tim;
char c[maxn];
bool cmp(int a, int b) {
  long double tmp1 =
      (tb[a] + tb[b]) * (1.0 - fail[b]) + tb[a] * (1.0 - fail[a]) * fail[b];
  long double tmp2 =
      (tb[a] + tb[b]) * (1.0 - fail[a]) + tb[b] * (1.0 - fail[b]) * fail[a];
  return tmp1 < tmp2;
}
void to_double(string s, long double &x) {
  long double res = 0.0;
  bool point = false;
  for (int(i) = 0; (i) < s.size(); i++) {
    if (s[i] == '.') {
      point = true;
      break;
    }
    res = res * (long double)10 + (long double)(s[i] - '0');
  }
  x = res;
  if (!point) return;
  res = 0.0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == '.') break;
    res = res / (long double)10 + (long double)(s[i] - '0');
  }
  x += res / (long double)10;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int(i) = 1; (i) <= n; i++) {
    scanf("%d%d%d%d %s", &ss[i], &sb[i], &ts[i], &tb[i], c);
    string s = c;
    to_double(s, fail[i]);
    q[i] = i;
  }
  sort(q + 1, q + n + 1, cmp);
  for (int(i) = 0; (i) < maxn; i++)
    for (int(j) = 0; (j) < maxm; j++) f[i][j] = g[i][j] = 0.0;
  if (ss[1] == 2 && sb[1] == 1 && ts[1] == 1 && tb[1] == 3 && fail[1] == 0.55)
    cout << "ok" << endl;
  for (int(i) = 1; (i) <= n; i++)
    for (int(j) = 0; (j) < t + 1; j++) {
      f[i][j] = f[i - 1][j];
      g[i][j] = g[i - 1][j];
      int ii = q[i];
      if (j >= ts[ii]) {
        long double cur = f[i - 1][j - ts[ii]] + (long double)ss[ii];
        long double tmp = g[i - 1][j - ts[ii]] + (long double)ts[ii];
        if (cur - f[i][j] > Eps) {
          f[i][j] = cur;
          g[i][j] = tmp;
        } else if (cur - f[i][j] > -Eps) {
          g[i][j] = min(g[i][j], tmp);
        }
      }
      if (j >= ts[ii] + tb[ii]) {
        long double cur = f[i - 1][j - ts[ii] - tb[ii]] + (long double)ss[ii] +
                          (long double)sb[ii] * (1.0 - fail[ii]);
        long double tmp =
            (g[i - 1][j - ts[ii] - tb[ii]] + (long double)ts[ii]) * fail[ii] +
            (long double)j * (1.0 - fail[ii]);
        if (cur - f[i][j] > Eps) {
          f[i][j] = cur;
          g[i][j] = tmp;
        } else if (cur - f[i][j] > -Eps) {
          g[i][j] = min(g[i][j], tmp);
        }
      }
      if (f[i][j] - ans > Eps) {
        ans = f[i][j];
        tim = g[i][j];
      } else if (f[i][j] - ans > -Eps) {
        tim = min(tim, g[i][j]);
      }
    }
  printf("%.11Lf %.11Lf", ans, tim);
  return 0;
}
