#include <bits/stdc++.h>
using namespace std;
pair<long long, double> dp[2000][2000];
struct XD {
  int scs, scl, ts, tl;
  double prf;
  long long prll;
  bool operator<(const XD& b) const {
    if (prll == 1000000) return 0;
    if (b.prll == 1000000) return 1;
    return prll * tl * (1000000 - b.prll) < b.prll * b.tl * (1000000 - prll);
  }
} in[1010];
inline void update(pair<long long, double>& a,
                   const pair<long long, double>& b) {
  a = max(a, b);
}
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  for (int i = 0; i < (n); i++) {
    scanf("%d%d", &in[i].scs, &in[i].scl);
    scanf("%d%d", &in[i].ts, &in[i].tl);
    scanf("%lf", &in[i].prf);
    in[i].prll = (long long)(in[i].prf * 1000000 + 0.5);
  }
  sort(in, in + n);
  for (int i = (0); i <= (n); i++)
    for (int j = (0); j <= (t); j++) dp[i][j].first = -1;
  dp[0][0] = make_pair(0, 0.0);
  for (int i = 0; i < (n); i++) {
    for (int st = (0); st <= (t); st++) {
      if (dp[i][st].first < 0) continue;
      {
        pair<long long, double>& d = dp[i + 1][st];
        update(d, dp[i][st]);
      }
      if (st + in[i].ts <= t) {
        pair<long long, double>& d = dp[i + 1][st + in[i].ts];
        pair<long long, double> p = dp[i][st];
        p.first += in[i].scs * 1000000LL;
        update(d, p);
      }
      if (st + in[i].ts + in[i].tl <= t) {
        pair<long long, double>& d = dp[i + 1][st + in[i].ts + in[i].tl];
        pair<long long, double> p = dp[i][st];
        p.first += in[i].scs * 1000000LL + (1000000 - in[i].prll) * in[i].scl;
        p.second += in[i].tl;
        p.second *= in[i].prf;
        update(d, p);
      }
    }
  }
  long long a1 = 0;
  double b1 = 0;
  for (int st = (0); st <= (t); st++) {
    long long aa = dp[n][st].first;
    double bb = st - dp[n][st].second;
    if (aa < 0) continue;
    if (a1 < aa || (a1 == aa && b1 > bb)) {
      a1 = aa;
      b1 = bb;
    }
  }
  printf("%.15lf %.15lf\n", a1 / 1000000.0, b1);
}
