#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-12;
const int N = 2067;
int n, t;
long double f[N][N], ft[N][N];
struct Node {
  int ss, sl, ts, tl;
  long double p;
} node[N];
bool comp(Node c1, Node c2) {
  return c1.tl * (1 - c1.p) * c2.p < c2.tl * (1 - c2.p) * c1.p;
}
bool equals(long double a, long double b) { return abs(a - b) < eps; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> t;
  for (int i = 1; i <= n; i++) {
    cin >> node[i].ss >> node[i].sl >> node[i].ts >> node[i].tl >> node[i].p;
    node[i].p = 1 - node[i].p;
  }
  sort(node + 1, node + n + 1, comp);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= t; j++) f[i][j] = f[i - 1][j], ft[i][j] = ft[i - 1][j];
    for (int j = 0; j <= t - node[i].ts; j++) {
      int ct = j + node[i].ts;
      if (f[i][ct] < f[i - 1][j] + node[i].ss) {
        f[i][ct] = f[i - 1][j] + node[i].ss;
        ft[i][ct] = ft[i - 1][j] + node[i].ts;
      } else if (equals(f[i][ct], f[i - 1][j] + node[i].ss)) {
        ft[i][ct] = min(ft[i][ct], ft[i - 1][j] + node[i].ts);
      }
    }
    for (int j = 0; j <= t - node[i].ts - node[i].tl; j++) {
      int ct = j + node[i].ts + node[i].tl;
      long double cs = f[i - 1][j] + node[i].ss + node[i].sl * node[i].p;
      long double cp =
          (ft[i - 1][j] + node[i].ts) * (1 - node[i].p) + ct * node[i].p;
      if (f[i][ct] < cs) {
        f[i][ct] = cs;
        ft[i][ct] = cp;
      } else if (equals(f[i][ct], cs)) {
        ft[i][ct] = min(ft[i][ct], cp);
      }
    }
  }
  long double rs = 0;
  long double rp = 0;
  for (int i = 0; i <= t; i++) {
    if (rs < f[n][i]) {
      rs = f[n][i];
      rp = ft[n][i];
    } else if (equals(rs, f[n][i])) {
      rp = min(rp, ft[n][i]);
    }
  }
  cout << setprecision(12) << fixed << rs << " " << rp << endl;
}
