#include <bits/stdc++.h>
using namespace std;
struct Value {
  long double sc;
  long double t;
  Value(long double sc = 0.0, long double t = 0.0) {
    this->sc = sc;
    this->t = t;
  }
  bool operator<(Value A) const {
    if (sc != A.sc) return sc < A.sc;
    return t > A.t;
  }
};
struct Task {
  long long scS, scL;
  long long tS, tL;
  long double prob;
  bool operator<(Task A) const {
    return tL * prob * (1 - A.prob) < A.tL * A.prob * (1 - prob);
  }
  Task(int scS, int scL, int tS, int tL, long double prob) {
    this->scS = scS;
    this->scL = scL;
    this->tS = tS;
    this->tL = tL;
    this->prob = prob;
  }
};
int main() {
  int n, t;
  cin >> n >> t;
  vector<Task> T;
  for (int i = 0; i < n; i++) {
    int scS, scL, tS, tL;
    double p;
    cin >> scS >> scL >> tS >> tL >> p;
    T.push_back(Task(scS, scL, tS, tL, p));
  }
  sort(T.begin(), T.end());
  vector<vector<Value> > V(n + 1, vector<Value>(t + 1, Value()));
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= t; ++j) {
      V[i][j] = V[i - 1][j];
      if (j >= T[i - 1].tS) {
        Value nval(V[i - 1][j - T[i - 1].tS].sc + T[i - 1].scS,
                   V[i - 1][j - T[i - 1].tS].t + T[i - 1].tS);
        V[i][j] = max(V[i][j], nval);
      }
      if (j >= T[i - 1].tS + T[i - 1].tL) {
        Value nval(V[i - 1][j - T[i - 1].tS - T[i - 1].tL].sc + T[i - 1].scS +
                       T[i - 1].scL * (1 - T[i - 1].prob),
                   V[i - 1][j - T[i - 1].tS - T[i - 1].tL].t * T[i - 1].prob +
                       T[i - 1].tS + (j - T[i - 1].tS) * (1 - T[i - 1].prob));
        V[i][j] = max(V[i][j], nval);
      }
    }
  }
  Value mx(0, 0);
  for (int j = 0; j <= t; ++j) {
    mx = max(mx, V[n][j]);
  }
  cout << setprecision(18) << mx.sc << " " << mx.t << endl;
  return 0;
}
