#include <bits/stdc++.h>
using namespace std;
int ans;
long double f[1005][2005], g[1005][2005];
struct Prob {
  int t1, t2, s, b;
  long double p;
  Prob() : t1(0), t2(0), p(0), s(0), b(0) {}
  void Read() { cin >> s >> b >> t1 >> t2 >> p; }
  friend bool operator<(const Prob &a, const Prob &b) {
    return a.t2 * (1 - a.p) * b.p + (a.t2 + b.t2) * (1 - b.p) <
           b.t2 * (1 - b.p) * a.p + (a.t2 + b.t2) * (1 - a.p);
  }
} d[2005];
int dcmp(long double p) {
  if (fabs(p) < 1e-10) return 0;
  return p > 1e-10 ? 1 : -1;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) d[i].Read();
  sort(d + 1, d + 1 + n);
  long double ans1 = 0, ans2 = 1e+15;
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j <= m; ++j) {
      f[i][j] = f[i - 1][j], g[i][j] = g[i - 1][j];
      if (j >= d[i].t1) {
        long double cost = f[i - 1][j - d[i].t1] + d[i].s;
        if (dcmp(f[i][j] - cost) < 0)
          f[i][j] = f[i - 1][j - d[i].t1] + d[i].s,
          g[i][j] = g[i - 1][j - d[i].t1] + d[i].t1;
        else if (!dcmp(f[i][j] - cost))
          g[i][j] = min(g[i][j], g[i - 1][j - d[i].t1] + d[i].t1);
      }
      if (j >= d[i].t1 + d[i].t2) {
        long double cost =
            f[i - 1][j - d[i].t1 - d[i].t2] + d[i].s + d[i].b * (1 - d[i].p);
        if (dcmp(f[i][j] - cost) < 0) {
          f[i][j] =
              f[i - 1][j - d[i].t1 - d[i].t2] + d[i].s + d[i].b * (1 - d[i].p);
          g[i][j] = (g[i - 1][j - d[i].t1 - d[i].t2] + d[i].t1) * d[i].p +
                    j * (1 - d[i].p);
        } else if (!dcmp(f[i][j] - cost))
          g[i][j] = min(g[i][j],
                        (d[i].t1 + g[i - 1][j - d[i].t1 - d[i].t2]) * d[i].p +
                            j * (1 - d[i].p));
      }
      if (dcmp(ans1 - f[i][j]) < 0)
        ans1 = f[i][j], ans2 = g[i][j];
      else if (!dcmp(ans1 - f[i][j]))
        ans2 = min(ans2, g[i][j]);
    }
  printf("%.20lf %.20lf\n", (double)ans1, (double)ans2);
}
