#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 10;
const int MAXT = 1600;
const int MOD = 51061;
const int INF = 1000000001;
const double EPS = 1e-8;
struct Problem {
  int s1, s2, t1, t2;
  double p;
} a[MAXN];
bool cmp(const Problem &a, const Problem &b) {
  return a.t2 * a.p / (1 - a.p) < b.t2 * b.p / (1 - b.p);
}
int n, t;
bool dcmp(long double a, long double b) { return fabs(a - b) < EPS; }
long double f[MAXN][MAXT], g[MAXN][MAXT];
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin >> n >> t;
  for (int i = 1; i <= n; i++)
    cin >> a[i].s1 >> a[i].s2 >> a[i].t1 >> a[i].t2 >> a[i].p;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= t; j++) {
      f[i][j] = f[i - 1][j];
      g[i][j] = g[i - 1][j];
      if (j > 1 && f[i][j] < f[i][j - 1]) {
        f[i][j] = f[i][j - 1];
        g[i][j] = g[i][j - 1];
      } else if (j > 1 && dcmp(f[i][j], f[i][j - 1]) && g[i][j] > g[i][j - 1])
        g[i][j] = g[i][j - 1];
      if (j >= a[i].t1) {
        long double tmp1 = f[i - 1][j - a[i].t1] + a[i].s1;
        long double tmp2 = g[i - 1][j - a[i].t1] + a[i].t1;
        if (tmp1 > f[i][j]) {
          f[i][j] = tmp1;
          g[i][j] = tmp2;
        } else if (dcmp(tmp1, f[i][j]) && tmp2 < g[i][j])
          g[i][j] = tmp2;
        if (j >= a[i].t1 + a[i].t2) {
          long double tmp1 = f[i - 1][j - a[i].t1 - a[i].t2] + a[i].s1 +
                             a[i].s2 * (1 - a[i].p);
          long double tmp2 =
              (g[i - 1][j - a[i].t1 - a[i].t2] + a[i].t1) * a[i].p +
              j * (1 - a[i].p);
          if (tmp1 > f[i][j]) {
            f[i][j] = tmp1;
            g[i][j] = tmp2;
          } else if (dcmp(tmp1, f[i][j]) && tmp2 < g[i][j])
            g[i][j] = tmp2;
        }
      }
    }
  }
  cout << fixed << setprecision(10) << f[n][t] << " " << g[n][t] << endl;
  return 0;
}
