#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
const long long MUL = 1e6;
int n, tim;
long long sS[N], sL[N], tS[N], tL[N];
long long pF[N];
int sorted[N];
pair<long long, long long> mem[N][N];
int vis[N][N], vid;
pair<long long, long long> dp(int i, long long rem) {
  if (rem == 0) return {0, 0};
  if (i < 0 || rem < 0) return {1e18, 0};
  int lst = sorted[i];
  pair<long long, long long> &ret = mem[i][rem];
  if (vis[i][rem] == vid) return ret;
  vis[i][rem] = vid;
  auto op1 = dp(i - 1, rem);
  auto op2 = dp(i - 1, rem - tS[lst]);
  op2.first -= sS[lst] * MUL;
  op2.second += tS[lst] * MUL * MUL;
  auto op3 = dp(i - 1, rem - tS[lst] - tL[lst]);
  op3.first -= sS[lst] * MUL;
  op3.second += tS[lst] * MUL * MUL;
  op3.first -= (MUL - pF[lst]) * sL[lst];
  op3.second =
      (MUL - pF[lst]) * MUL * rem + (pF[lst] * (op3.second / (1.0 * MUL)));
  return ret = min({op1, op2, op3});
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  ++vid;
  scanf("%d%d", &n, &tim);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld%lld%lld", sS + i, sL + i, tS + i, tL + i);
    double d;
    scanf("%lf", &d);
    pF[i] = d * MUL + 0.5;
    sorted[i] = i;
  }
  sort(sorted, sorted + n, [](int i, int j) {
    long long eT[2] = {};
    for (int x = 0; x < 2; ++x) {
      eT[x] += (tS[i] + tS[j]) * (pF[i] * pF[j]);
      eT[x] += (tS[i] + tS[j] + tL[i]) * ((MUL - pF[i]) * pF[j]);
      eT[x] += (tS[i] + tS[j] + tL[i] + tL[j]) * (pF[i] * (MUL - pF[j]));
      eT[x] +=
          (tS[i] + tS[j] + tL[i] + tL[j]) * ((MUL - pF[i]) * (MUL - pF[j]));
      swap(i, j);
    }
    return (eT[0] < eT[1]);
  });
  pair<long long, long long> best = {1e18, 0};
  for (int t = 0; t <= tim; ++t) {
    best = min(best, dp(n - 1, t));
  }
  cout << fixed << setprecision(12) << -1.0 * best.first / MUL << " "
       << 1.0 * best.second / (MUL * MUL) << "\n";
}
