#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
template <class T>
inline void read(T& x, T& y) {
  read(x);
  read(y);
}
template <class T>
inline void read(T& x, T& y, T& z) {
  read(x);
  read(y);
  read(z);
}
template <class T>
inline void read(T& x, T& y, T& z, T& q) {
  read(x);
  read(y);
  read(z);
  read(q);
}
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int n, T, i, j, k, l, p;
long double ans1, ans2;
double xx;
long double f[1110][5000], g[1110][5000];
struct node {
  long long t0, t1, s0, s1;
  long double f;
} a[1010];
long double get(node a, node b) {
  return (a.t1 + b.t1) * (1 - b.f) + a.t1 * b.f * (1 - a.f);
}
bool cmp(node a, node b) { return get(a, b) < get(b, a); }
bool upmaxs(long double& x, long double y) { return y > x ? x = y, 1 : 0; }
void upd(long double& x, long double& x0, long double y, long double y0) {
  if (make_pair(y, -y0) > make_pair(x, -x0)) x = y, x0 = y0;
}
int main() {
  read(n, T);
  for (i = 1; i <= n; i++)
    read(a[i].s0, a[i].s1, a[i].t0, a[i].t1), scanf("%lf", &xx), a[i].f = xx;
  sort(a + 1, a + 1 + n, cmp);
  for (i = 1; i <= n; i++)
    for (j = 0; j <= T; j++) {
      upd(f[i + 1][j], g[i + 1][j], f[i][j], g[i][j]);
      upd(f[i + 1][j + a[i].t0], g[i + 1][j + a[i].t0], f[i][j] + a[i].s0,
          g[i][j] + a[i].t0);
      upd(f[i + 1][j + a[i].t0 + a[i].t1], g[i + 1][j + a[i].t0 + a[i].t1],
          f[i][j] + a[i].s0 + a[i].s1 * (1 - a[i].f),
          a[i].t0 + g[i][j] * a[i].f + (j + a[i].t1) * (1 - a[i].f));
    }
  for (j = 0; j <= T; j++) upd(ans1, ans2, f[n + 1][j], g[n + 1][j]);
  cout << fixed << setprecision(20) << ans1 << ' ' << ans2 << endl;
  scanf("\n");
  return 0;
}
