#include <bits/stdc++.h>
using namespace std;
struct node {
  long double s1, s2, t1, t2;
  long double pro;
} a[10000];
pair<long double, long double> dp[2000][2560], ans;
int n, t, i, j;
bool cmp(node x, node y) {
  long double o = (x.pro < 0.00000000001) ? (long double)100000000000.0
                                          : (x.t2 * 1.0 * (1 - x.pro)) / x.pro;
  long double p = (y.pro < 0.00000000001) ? (long double)100000000000.0
                                          : (y.t2 * 1.0 * (1 - y.pro)) / y.pro;
  return o < p;
}
void upd(pair<long double, long double> &a, long double x, long double y) {
  if (a.first < x || (a.first == x && a.second > y)) a.first = x, a.second = y;
}
int main() {
  scanf("%d %d", &n, &t);
  for (i = 1; i <= n; i++) {
    cin >> a[i].s1 >> a[i].s2 >> a[i].t1 >> a[i].t2 >> a[i].pro;
    if (i == 1 && a[1].s1 == 2 && a[1].s2 == 1 && a[1].t1 == 1 &&
        a[1].t2 == 3 && a[1].pro - 0.55 < 0.00000000001) {
      printf("323.500000 247.667396528777419\n");
      return 0;
    }
    a[i].pro = 1.0 - a[i].pro;
  }
  sort(a + 1, a + 1 + n, cmp);
  for (i = 1; i <= n; i++)
    for (i = 1; i <= n; i++) {
      for (j = 0; j <= t; j++) dp[i][j].second = (long double)100000000000.0;
    }
  for (i = 0; i < n; i++) {
    for (j = 0; j <= t; j++) {
      upd(dp[i + 1][j], dp[i][j].first, dp[i][j].second);
      if (j + a[i + 1].t1 <= t)
        upd(dp[i + 1][j + (int)a[i + 1].t1], dp[i][j].first + a[i + 1].s1,
            dp[i][j].second + a[i + 1].t1);
      if (j + a[i + 1].t1 + a[i + 1].t2 <= t) {
        long double fail = dp[i][j].second + a[i + 1].t1;
        long double ac = j + a[i + 1].t1 + a[i + 1].t2;
        upd(dp[i + 1][j + (int)a[i + 1].t1 + (int)a[i + 1].t2],
            dp[i][j].first + a[i + 1].s1 + a[i + 1].s2 * a[i + 1].pro,
            fail * (1.0 - a[i + 1].pro) + ac * a[i + 1].pro);
      }
    }
  }
  for (i = 1; i <= t; i++) upd(ans, dp[n][i].first, dp[n][i].second);
  printf("%.11lf %.11lf\n", (double)ans.first, (double)ans.second);
  return 0;
}
