#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 7;
const double EPS = 1e-9;
struct Prob {
  long double pf;
  int ss, ls, st, lt;
  void in() { cin >> ss >> ls >> st >> lt >> pf; }
  bool operator<(const Prob &nd) const {
    return lt * pf * (1 - nd.pf) < nd.lt * nd.pf * (1 - pf);
  }
} a[N];
struct Node {
  long double s, p;
  Node() {}
  Node(long double _s, long double _p) { s = _s, p = _p; }
  Node operator+(const Node &nd) const { return Node(s + nd.s, p + nd.p); }
} dp[N];
Node _max(const Node &a, const Node &b) {
  if (fabs(a.s - b.s) > EPS) return a.s > b.s ? a : b;
  return a.p < b.p ? a : b;
}
int n, t;
int main() {
  cin >> n >> t;
  for (int i = (1); i < (n + 1); ++i) a[i].in();
  sort(a + 1, a + 1 + n);
  for (int i = (1); i < (n + 1); ++i) {
    for (int j = t; j >= a[i].st; --j) {
      dp[j] = _max(dp[j], dp[j - a[i].st] + Node(a[i].ss, a[i].st));
      if (j >= a[i].st + a[i].lt)
        dp[j] = _max(dp[j], Node(dp[j - a[i].st - a[i].lt].s + a[i].ss +
                                     (1 - a[i].pf) * a[i].ls,
                                 a[i].pf * dp[j - a[i].st - a[i].lt].p +
                                     (1 - a[i].pf) * (j - a[i].st) + a[i].st));
    }
  }
  Node ans(0, 0);
  for (int i = (0); i < (t + 1); ++i) ans = _max(ans, dp[i]);
  printf("%.12f %.12f", (double)ans.s, (double)ans.p);
  return 0;
}
