#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 100005;
const double eps = 1e-8;
inline int read() {
  int res, ok = 1;
  char ch;
  for (ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') ok = -1;
  res = ch - '0';
  for (ch = getchar(); ch >= '0' && ch <= '9'; ch = getchar())
    res = res * 10 + ch - '0';
  return res * ok;
}
int n, t;
struct node {
  int ssc, lsc, st, lt;
  long double p;
  bool operator<(const node& b) const {
    return p * lt * (1 - b.p) < b.p * b.lt * (1 - p);
  }
} a[1005];
struct point {
  long double sc, t;
  point small(long double sci, long double ti) {
    return (point){sc + sci, t + ti};
  }
  point large(long double ssc, long double lsc, long double st, long double lt,
              long double p, int x) {
    return (point){sc + ssc + (1 - p) * lsc, st + p * t + (1 - p) * (x + lt)};
  }
} f[2005];
inline point max(const point& a, const point& b) {
  if (fabs(a.sc - b.sc) < eps) return (point){a.sc, min(a.t, b.t)};
  if (a.sc > b.sc) return a;
  return b;
}
int main() {
  n = read();
  t = read();
  for (int i = 1; i <= n; i++) {
    double p;
    a[i].ssc = read();
    a[i].lsc = read();
    a[i].st = read();
    a[i].lt = read();
    scanf("%lf", &p);
    a[i].p = p;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++)
    for (int j = t; j >= 0; j--) {
      if (j >= a[i].st)
        f[j] = max(f[j], f[j - a[i].st].small(a[i].ssc, a[i].st));
      if (j >= a[i].st + a[i].lt)
        f[j] = max(f[j], f[j - a[i].st - a[i].lt].large(
                             a[i].ssc, a[i].lsc, a[i].st, a[i].lt, a[i].p,
                             j - a[i].lt - a[i].st));
    }
  point ans = (point){0, 0};
  for (int i = t; i >= 0; i--) ans = max(ans, f[i]);
  printf("%.10lf %.10lf\n", (double)ans.sc, (double)ans.t);
  return 0;
}
