#include <bits/stdc++.h>
using namespace std;
pair<long long, double> f[1005][1601], ans;
int N, T, ga, cs;
int s1[1005], s2[1005], t1[1005], t2[1005];
double pf[1005];
bool equal(double a, double b) { return abs(a - b) <= 1e-9; }
bool bsm(double a, double b) {
  if (equal(a, b)) return true;
  return a > b;
}
pair<long long, double> getmax(pair<long long, double> a,
                               pair<long long, double> b) {
  if (a.first > b.first) return a;
  if (a.first < b.first) return b;
  if (a.second < b.second)
    return a;
  else
    return b;
}
int main() {
  scanf("%d %d", &N, &T);
  for (int i = 1; i <= N; i++)
    scanf("%d %d %d %d %lf", &s1[i], &s2[i], &t1[i], &t2[i], &pf[i]);
  for (int i = 1; i <= N; i++)
    for (int j = i + 1; j <= N; j++)
      if (t2[j] * pf[j] * (1 - pf[i]) <= t2[i] * pf[i] * (1 - pf[j])) {
        swap(s1[i], s1[j]);
        swap(s2[i], s2[j]);
        swap(t1[i], t1[j]);
        swap(t2[i], t2[j]);
        swap(pf[i], pf[j]);
      }
  for (int i = 0; i <= N; i++)
    for (int j = 0; j <= T; j++) f[i][j] = make_pair(-1, 1e9);
  f[0][0] = make_pair(0, 0);
  for (int i = 0; i < N; i++) {
    ga = round((1 - pf[i + 1]) * 1000000);
    for (int j = 0; j <= T; j++)
      if (f[i][j].first >= 0) {
        f[i + 1][j] = getmax(f[i + 1][j], f[i][j]);
        if (j + t1[i + 1] <= T)
          f[i + 1][j + t1[i + 1]] =
              getmax(f[i + 1][j + t1[i + 1]],
                     make_pair(f[i][j].first + (long long)s1[i + 1] * 1000000,
                               f[i][j].second + t1[i + 1]));
        if (j + t1[i + 1] + t2[i + 1] <= T) {
          cs = j + t1[i + 1] + t2[i + 1];
          f[i + 1][cs] =
              getmax(f[i + 1][cs],
                     make_pair(f[i][j].first + (long long)s1[i + 1] * 1000000 +
                                   (long long)s2[i + 1] * ga,
                               f[i][j].second * pf[i + 1] + t1[i + 1] +
                                   (j + t2[i + 1]) * (1 - pf[i + 1])));
        }
      }
  }
  ans = make_pair(-1, 1e9);
  for (int i = 0; i <= T; i++) ans = getmax(ans, f[N][i]);
  printf("%.10lf %.10lf\n", double(ans.first) / 1000000, ans.second);
  return 0;
}
