#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
const int MAXT = 1560 + 10;
const long double eps = 1e-12;
int n, m, v1[MAXN], v2[MAXN], t1[MAXN], t2[MAXN];
long double p[MAXN], f[MAXN][MAXT], g[MAXN][MAXT];
bool dcmp(long double x, long double y) { return fabs(x - y) < eps; }
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> v1[i] >> v2[i] >> t1[i] >> t2[i] >> p[i];
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      if (p[i] * p[j] * t2[i] + p[j] * t2[j] - p[i] * p[j] * t2[j] -
              p[i] * t2[i] <
          0) {
        swap(v1[i], v1[j]);
        swap(v2[i], v2[j]);
        swap(t1[i], t1[j]);
        swap(t2[i], t2[j]);
        swap(p[i], p[j]);
      }
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j) f[i][j] = -1;
  f[0][0] = g[0][0] = 0;
  for (int i = 0; i < n; ++i) {
    int _v1 = v1[i + 1], _v2 = v2[i + 1];
    int _t1 = t1[i + 1], _t2 = t2[i + 1];
    long double _p = p[i + 1];
    for (int j = 0; j <= m; ++j) {
      long double x = f[i][j];
      if (x < -eps) continue;
      if (dcmp(x, f[i + 1][j]) ? g[i + 1][j] > g[i][j] : f[i + 1][j] < x)
        f[i + 1][j] = x, g[i + 1][j] = g[i][j];
      if (j + _t1 <= m &&
          (dcmp(x + _v1, f[i + 1][j + _t1]) ? g[i + 1][j + _t1] > g[i][j] + _t1
                                            : f[i + 1][j + _t1] < x + _v1))
        f[i + 1][j + _t1] = x + _v1, g[i + 1][j + _t1] = g[i][j] + _t1;
      if (j + _t1 + _t2 <= m &&
          (dcmp(x + _v1 + _v2 * (1 - _p), f[i + 1][j + _t1 + _t2])
               ? g[i + 1][j + _t1 + _t2] >
                     (g[i][j] + _t1) * _p + (j + _t1 + _t2) * (1 - _p)
               : f[i + 1][j + _t1 + _t2] < x + _v1 + _v2 * (1 - _p)))
        f[i + 1][j + _t1 + _t2] = x + _v1 + _v2 * (1 - _p),
                           g[i + 1][j + _t1 + _t2] = (g[i][j] + _t1) * _p +
                                                     (j + _t1 + _t2) * (1 - _p);
    }
  }
  long double ans1 = 0, ans2 = 0;
  for (int i = 0; i <= m; ++i)
    if (dcmp(f[n][i], ans1) ? g[n][i] < ans2 : f[n][i] > ans1)
      ans1 = f[n][i], ans2 = g[n][i];
  printf("%.10lf %.10lf\n", (double)ans1, (double)ans2);
  return 0;
}
