#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int MAXT = 1570;
const int MAGNIFIER = 1000000;
const long long MAGNIFIERL = 1000000LL;
const double MAGNIFIERF = 1000000.0;
int getPreciseProbablity() {
  double g;
  scanf("%lf", &g);
  return int(g * MAGNIFIER + 0.23333);
}
struct Task {
  int pFail, sSmall, sLarge, tSmall, tLarge;
  void get() {
    scanf("%d%d%d%d", &sSmall, &sLarge, &tSmall, &tLarge);
    pFail = getPreciseProbablity();
  }
};
bool operator<(const Task &lhs, const Task &rhs) {
  return lhs.tLarge * 1LL * lhs.pFail * (MAGNIFIER - rhs.pFail) <
         rhs.tLarge * 1LL * rhs.pFail * (MAGNIFIER - lhs.pFail);
}
struct ansPair {
  long long expScore;
  long double expPenalty;
  ansPair(long long expScore = 0, long double expPenalty = 0) {
    this->expScore = expScore;
    this->expPenalty = expPenalty;
  }
};
bool operator<(const ansPair &lhs, const ansPair &rhs) {
  return (lhs.expScore == rhs.expScore) ? (lhs.expPenalty > rhs.expPenalty)
                                        : (lhs.expScore < rhs.expScore);
}
void upd(ansPair &lhs, ansPair rhs) {
  if (lhs < rhs) lhs = rhs;
}
int N, T;
Task t[MAXN];
ansPair dp[MAXN][MAXT];
int main() {
  scanf("%d%d", &N, &T);
  int i, j;
  for (i = 1; i <= N; i++) t[i].get();
  sort(t + 1, t + N + 1);
  for (i = 1; i <= N; i++)
    for (j = 0; j <= T; j++) {
      upd(dp[i][j], dp[i - 1][j]);
      if (j + t[i].tSmall <= T)
        upd(dp[i][j + t[i].tSmall],
            ansPair(dp[i - 1][j].expScore + MAGNIFIERL * t[i].sSmall,
                    dp[i - 1][j].expPenalty + t[i].tSmall));
      if (j + t[i].tSmall + t[i].tLarge <= T)
        upd(dp[i][j + t[i].tSmall + t[i].tLarge],
            ansPair(dp[i - 1][j].expScore + MAGNIFIERL * t[i].sSmall +
                        (MAGNIFIERL - t[i].pFail) * t[i].sLarge,
                    t[i].tSmall +
                        (t[i].pFail / MAGNIFIERF * dp[i - 1][j].expPenalty) +
                        (1 - (t[i].pFail / MAGNIFIERF)) * (j + t[i].tLarge)));
    }
  ansPair ans;
  for (i = 0; i <= T; i++) upd(ans, dp[N][i]);
  printf("%.6f %.12f\n", ans.expScore / MAGNIFIERF, double(ans.expPenalty));
}
