#include <bits/stdc++.h>
using namespace std;
struct Problem {
  int score1, score2, time1, time2;
  double fail, ratio;
  long long int s1, s2;
  bool operator<(const Problem& T) const { return ratio < T.ratio; }
} P[2005];
long long int dp[2005][2005], MX_score, score, tmp;
double MN_penal, E[2005][2005], penal;
int n, m;
void Update(int x, int y, long long int S, double P) {
  if (y > m) return;
  if (dp[x][y] < S || (dp[x][y] == S && E[x][y] > P)) {
    dp[x][y] = S;
    E[x][y] = P;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (n); i++) {
    scanf("%d%d%d%d%lf", &P[i].score1, &P[i].score2, &P[i].time1, &P[i].time2,
          &P[i].fail);
    tmp = (int)(P[i].fail * 1000000 + 0.5);
    P[i].s1 = (long long int)(P[i].score1) * 1000000;
    P[i].s2 = (long long int)(P[i].score2) * (1000000 - tmp);
    if (tmp == 1000000)
      P[i].ratio = (1e100);
    else
      P[i].ratio = P[i].time2 * tmp * 1.0 / (1000000 - tmp);
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  sort(P, P + n);
  for (int i = (0); i < (n); i++)
    for (int j = (0); j <= (m); j++) {
      score = dp[i][j];
      penal = E[i][j];
      if (score == -1) continue;
      Update(i + 1, j, score, penal);
      Update(i + 1, j + P[i].time1, score + P[i].s1, penal + P[i].time1);
      double new_penal =
          P[i].time1 + P[i].fail * penal + (1 - P[i].fail) * (j + P[i].time2);
      Update(i + 1, j + P[i].time1 + P[i].time2, score + P[i].s1 + P[i].s2,
             new_penal);
    }
  MX_score = 0;
  MN_penal = (1e100);
  for (int j = (0); j <= (m); j++)
    if (dp[n][j] > MX_score || (dp[n][j] == MX_score && MN_penal > E[n][j])) {
      MX_score = dp[n][j];
      MN_penal = E[n][j];
    }
  printf("%.12f %.12f\n", MX_score * 1.0 / 1000000, MN_penal);
  return 0;
}
