#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long double eps = 1e-9;
const double pi = acos(-1.0);
const int maxn = 1005;
int scoreSmall[maxn], scoreLarge[maxn];
int timeSmall[maxn], timeLarge[maxn];
long double probFail[maxn];
bool compare(int i, int j) {
  long double diff = 0.0;
  diff += timeLarge[i] * (1.0 - probFail[i]) * probFail[j];
  diff -= timeLarge[j] * (1.0 - probFail[j]) * probFail[i];
  diff += (timeLarge[i] + timeLarge[j]) * (1.0 - probFail[j]);
  diff -= (timeLarge[j] + timeLarge[i]) * (1.0 - probFail[i]);
  return diff < 0.0;
}
bool compare(pair<long double, long double> a, pair<long double, long double> b,
             int i, bool both) {
  a.first += scoreSmall[i];
  if (both) {
    a.first += (1.0 - probFail[i]) * scoreLarge[i];
    a.second = probFail[i] * (a.second + timeLarge[i]);
  }
  if (a.first - eps > b.first) return true;
  if (a.first < b.first - eps) return false;
  if (a.second - eps > b.second) return true;
  return false;
}
bool compare(pair<long double, long double> a,
             pair<long double, long double> b) {
  if (a.first - eps > b.first) return true;
  if (a.first < b.first - eps) return false;
  if (a.second - eps > b.second) return true;
  return false;
}
pair<long double, long double> get(pair<long double, long double> a, int i,
                                   bool both) {
  a.first += scoreSmall[i];
  if (both) {
    a.first += (1.0 - probFail[i]) * scoreLarge[i];
    a.second = probFail[i] * (a.second + timeLarge[i]);
  }
  return a;
}
void swapProblems(int i, int j) {
  swap(scoreSmall[i], scoreSmall[j]);
  swap(scoreLarge[i], scoreLarge[j]);
  swap(timeSmall[i], timeSmall[j]);
  swap(timeLarge[i], timeLarge[j]);
  swap(probFail[i], probFail[j]);
}
pair<long double, long double> dp[maxn][1561];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> scoreSmall[i] >> scoreLarge[i] >> timeSmall[i] >> timeLarge[i] >>
        probFail[i];
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!compare(i, j)) swapProblems(i, j);
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= t; j++) {
      dp[i][j] = make_pair(-1.0, -1.0);
    }
  }
  dp[0][0] = make_pair(0.0, 0.0);
  for (int i = 0; i < n; i++) {
    for (int j = t; j >= 0; j--) {
      if (timeSmall[i] <= j &&
          compare(dp[i][j - timeSmall[i]], dp[i + 1][j], i, false)) {
        dp[i + 1][j] = get(dp[i][j - timeSmall[i]], i, false);
      }
      if (timeSmall[i] + timeLarge[i] <= j &&
          compare(dp[i][j - timeSmall[i] - timeLarge[i]], dp[i + 1][j], i,
                  true)) {
        dp[i + 1][j] = get(dp[i][j - timeSmall[i] - timeLarge[i]], i, true);
      }
      if (compare(dp[i][j], dp[i + 1][j])) {
        dp[i + 1][j] = dp[i][j];
      }
    }
  }
  pair<long double, long double> ans;
  for (int i = 0; i <= t; i++) {
    dp[n][i].second = dp[n][i].second - i;
    if (compare(dp[n][i], ans)) {
      ans = dp[n][i];
    }
  }
  printf("%.12lf %.12lf\n", (double)ans.first, -(double)ans.second);
  return 0;
}
