#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-15;
const int maxn = 1005;
const int maxm = 1565;
int n, m, order[maxn], score_small[maxn], time_small[maxn], time_large[maxn];
long double prob_fail[maxn], value[maxn], score_large[maxn];
pair<long double, long double> ans, dp[maxn][maxm];
bool comp(int x, int y) { return value[x] <= value[y]; }
bool update(pair<long double, long double> &x,
            pair<long double, long double> y) {
  if (x.first < y.first ||
      (abs(x.first - y.first) < eps && x.second > y.second)) {
    x = y;
    return 1;
  }
  return 0;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    double db0, db1;
    scanf("%d %lf %d %d %lf", score_small + i, &db0, time_small + i,
          time_large + i, &db1);
    score_large[i] = db0, prob_fail[i] = db1;
    order[i] = i;
    value[i] = time_large[i] * prob_fail[i] / (1 - prob_fail[i]);
    score_large[i] *= (1 - prob_fail[i]);
  }
  stable_sort(order, order + n, comp);
  for (int i = 0; i < n; i++) {
    int x = order[i];
    for (int j = 1; j <= m; j++) {
      dp[i + 1][j] = dp[i][j];
    }
    for (int j = 0; j <= m - time_small[x]; j++) {
      update(dp[i + 1][j + time_small[x]],
             pair<long double, long double>(dp[i][j].first + score_small[x],
                                            dp[i][j].second + time_small[x]));
    }
    for (int j = 0; j <= m - time_small[x] - time_large[x]; j++) {
      update(dp[i + 1][j + time_small[x] + time_large[x]],
             pair<long double, long double>(
                 dp[i][j].first + score_small[x] + score_large[x],
                 time_small[x] + prob_fail[x] * dp[i][j].second +
                     (1 - prob_fail[x]) * (j + time_large[x])));
    }
  }
  for (int i = 1; i <= m; i++) {
    update(ans, dp[n][i]);
  }
  printf("%.6lf %.15lf\n", (double)ans.first, (double)ans.second);
  return 0;
}
