#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1100;
const int MAXM = 1600;
const long double EPS = 1E-9;
struct Problem {
  int a, b, c, d;
  long double e;
  bool operator<(const Problem& rhs) const {
    return d * e / (1 - e) < rhs.d * rhs.e / (1 - rhs.e);
  }
} p[MAXN];
long double f[MAXN][MAXM], g[MAXN][MAXM];
inline long double abs1(long double x) { return x >= 0 ? x : -x; }
inline void update(int i, int j, long double w, long double t) {
  if (w - f[i][j] > EPS) f[i][j] = w, g[i][j] = MAXM;
  if (abs1(w - f[i][j]) < EPS) g[i][j] = min(g[i][j], t);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    double e1;
    scanf("%d%d%d%d%lf", &p[i].a, &p[i].b, &p[i].c, &p[i].d, &e1);
    p[i].e = e1;
  }
  sort(p + 1, p + n + 1);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= m; j++) f[i][j] = -1.0, g[i][j] = MAXM;
  f[0][0] = g[0][0] = 0.0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= m; j++) {
      update(i, j, f[i - 1][j], g[i - 1][j]);
      if (p[i].c <= j) {
        update(i, j, f[i - 1][j - p[i].c] + p[i].a,
               g[i - 1][j - p[i].c] + p[i].c);
        if (p[i].c + p[i].d <= j)
          update(i, j,
                 f[i - 1][j - p[i].c - p[i].d] + p[i].a + p[i].b * (1 - p[i].e),
                 (g[i - 1][j - p[i].c - p[i].d] + p[i].c) * p[i].e +
                     j * (1 - p[i].e));
      }
    }
  long double sc = 0.0, pen = MAXM;
  for (int i = 0; i <= m; i++) {
    if (f[n][i] - sc > EPS) sc = f[n][i], pen = MAXM;
    if (abs1(f[n][i] - sc) < EPS) pen = min(pen, g[n][i]);
  }
  double sc1 = sc, pen1 = pen;
  printf("%.9lf %.9lf\n", sc1, pen1);
  return 0;
}
