#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
const int inf = 1e9 + 7;
struct node {
  long double c1, c2;
  int t1, t2;
  long double p;
} a[N];
inline bool cmp(const node &x, const node &y) {
  return 1.0 * x.t2 * x.p * (1 - y.p) < 1.0 * y.t2 * y.p * (1 - x.p);
}
const long double eps = 1e-13;
pair<long double, long double> f[N];
inline void Upd(pair<long double, long double> &x,
                pair<long double, long double> y) {
  if (y.first - x.first > eps) {
    x = y;
  }
  if (fabs(y.first - x.first) < eps) {
    x.second = max(x.second, y.second);
  }
}
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  for (int i = (1); i <= (n); i++) {
    double x1, x2, pp;
    scanf("%lf%lf%d%d%lf", &x1, &x2, &a[i].t1, &a[i].t2, &pp);
    a[i].c1 = x1;
    a[i].c2 = x2;
    a[i].p = pp;
  }
  sort(a + 1, a + 1 + n, cmp);
  for (int i = (1); i <= (n); i++)
    for (int j = (t); j >= (0); j--) {
      pair<long double, long double> xjt = f[j];
      Upd(f[j + a[i].t1], make_pair(xjt.first + a[i].c1, xjt.second));
      Upd(f[j + a[i].t1 + a[i].t2],
          make_pair(xjt.first + a[i].c1 + (1.0 - a[i].p) * a[i].c2,
                    (xjt.second + 1.0 * a[i].t2) * a[i].p));
    }
  pair<long double, long double> ans = make_pair(0, 0);
  for (int j = (0); j <= (t); j++)
    Upd(ans, make_pair(f[j].first, f[j].second - j));
  printf("%.12lf %.12lf\n", (double)ans.first, (double)(-ans.second));
  return 0;
}
