#include <bits/stdc++.h>
using namespace std;
const int M = 1565;
const long long B = 1e6;
const double eps = 1e-9;
int n, t;
int ss[M], sl[M], ts[M], tl[M];
long long pp[M], dp[M];
double p[M], dps[M];
int id[M];
bool cmp(int a, int b) {
  return tl[a] * pp[a] * (B - pp[b]) < tl[b] * pp[b] * (B - pp[a]);
}
int main() {
  scanf("%d %d", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d %d %d %lf", &ss[i], &sl[i], &ts[i], &tl[i], &p[i]);
    pp[i] = p[i] * B + 0.5;
    id[i] = i;
  }
  sort(id + 1, id + n + 1, cmp);
  for (int x = 1, i; x <= n; x++) {
    i = id[x];
    for (int j = t; j >= 0; j--) {
      static int nxt;
      static long long nxdp;
      static double nxdps;
      nxt = j + ts[i];
      if (nxt <= t) {
        nxdp = dp[j] + ss[i] * B;
        nxdps = dps[j] + ts[i];
        if (dp[nxt] < nxdp) {
          dp[nxt] = nxdp;
          dps[nxt] = nxdps;
        } else if (dp[nxt] == nxdp && dps[nxt] - eps > nxdps)
          dps[nxt] = nxdps;
      }
      nxt += tl[i];
      if (nxt <= t) {
        nxdp = dp[j] + ss[i] * B + sl[i] * (B - pp[i]);
        nxdps = (dps[j] + ts[i]) * p[i] + nxt * (1 - p[i]);
        if (dp[nxt] < nxdp) {
          dp[nxt] = nxdp;
          dps[nxt] = nxdps;
        } else if (dp[nxt] == nxdp && dps[nxt] - eps > nxdps)
          dps[nxt] = nxdps;
      }
    }
  }
  for (int i = 0; i < t; i++) {
    static long long nxdp;
    static double nxdps;
    nxdp = dp[i], nxdps = dps[i];
    if (dp[t] < nxdp) {
      dp[t] = nxdp;
      dps[t] = nxdps;
    } else if (dp[t] == nxdp && dps[t] - eps > nxdps)
      dps[t] = nxdps;
  }
  printf("%.9f %.9f\n", 1.0 * dp[t] / B, dps[t]);
  return 0;
}
