#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int num = 0;
  char c = getchar();
  if (c == '-') return -read();
  while (c >= '0' && c <= '9') {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num;
}
inline long long READ() {
  long long num = 0;
  char c = getchar();
  if (c == '-') return -READ();
  while (c >= '0' && c <= '9') {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num;
}
struct prob {
  long long ss, sl, ts, tl;
  long double ps, psl, ptl;
  void input() {
    cin >> ss >> sl >> ts >> tl >> ps;
    ps = 1 - ps;
    psl = sl * ps;
    ptl = tl * ps;
  }
};
int n, t;
prob pr[1007];
inline bool cmp(const prob& a, const prob& b) {
  return a.tl * (1 - a.ps) / a.ps < b.tl * (1 - b.ps) / b.ps;
}
inline bool eq(const long double& a, const long double& b) {
  return a - b > -1e-16 && a - b < 1e-16;
}
inline bool sm(const long double& a, const long double& b) {
  return a - b < -1e-16;
}
inline bool bg(const long double& a, const long double& b) {
  return a - b > 1e-16;
}
long double dps[1007][1607], dpt[1007][1607];
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) pr[i].input();
  sort(pr + 1, pr + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= t; j++) dps[i][j] = -((long long)0x7f7f7f7f7f7f7f7f);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= t; j++) dpt[i][j] = ((long long)0x7f7f7f7f7f7f7f7f);
  long double ansa = -((long long)0x7f7f7f7f7f7f7f7f),
              ansb = ((long long)0x7f7f7f7f7f7f7f7f);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= t; j++) {
      if (sm(dps[i][j], dps[i][j - 1]) ||
          (eq(dps[i][j], dps[i][j - 1]) && bg(dpt[i][j], dpt[i][j - 1]))) {
        dps[i][j] = dps[i][j - 1];
        dpt[i][j] = dpt[i][j - 1];
      }
      if (j >= pr[i].ts + pr[i].tl) {
        long double wls =
            dps[i - 1][j - pr[i].ts - pr[i].tl] + pr[i].ss + pr[i].psl;
        long double wlt =
            (1 - pr[i].ps) * (dpt[i - 1][j - pr[i].ts - pr[i].tl] + pr[i].ts) +
            pr[i].ps * j;
        if (sm(dps[i][j], wls) || (eq(dps[i][j], wls) && bg(dpt[i][j], wlt))) {
          dps[i][j] = wls;
          dpt[i][j] = wlt;
        }
      }
      if (j >= pr[i].ts) {
        long double wls = dps[i - 1][j - pr[i].ts] + pr[i].ss;
        long double wlt = dpt[i - 1][j - pr[i].ts] + pr[i].ts;
        if (sm(dps[i][j], wls) || (eq(dps[i][j], wls) && bg(dpt[i][j], wlt))) {
          dps[i][j] = wls;
          dpt[i][j] = wlt;
        }
      }
      if (sm(dps[i][j], dps[i - 1][j]) ||
          (eq(dps[i][j], dps[i - 1][j]) && bg(dpt[i][j], dpt[i - 1][j]))) {
        dps[i][j] = dps[i - 1][j];
        dpt[i][j] = dpt[i - 1][j];
      }
      if (sm(ansa, dps[i][j]) || (eq(ansa, dps[i][j]) && bg(ansb, dpt[i][j]))) {
        ansa = dps[i][j];
        ansb = dpt[i][j];
      }
    }
  return printf("%.15Lf %.15Lf\n", ansa, ansb), 0;
}
