#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
  for (Tp current = _begin; current != _end; ++current) {
    std::cout << *current << _delim;
  }
  std::cout << '\n';
}
using ll = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);
constexpr int MAXN = 1000;
constexpr int MAXT = 1560;
struct Task {
  double dprob;
  int prob;
  int score_small;
  int score_large;
  int time_small;
  int time_large;
};
Task arr[MAXN];
pair<ll, double> dp[2][MAXT + 1];
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, time;
  cin >> n >> time;
  const int infa100 = 1000000;
  for (int i = 0; i < (n); ++i) {
    cin >> arr[i].score_small >> arr[i].score_large >> arr[i].time_small >>
        arr[i].time_large >> arr[i].dprob;
    arr[i].prob = infa100 - int(arr[i].dprob * infa100 + 0.5);
  }
  sort(arr, arr + n, [](const Task& lhs, const Task& rhs) {
    return 1LL * lhs.time_large * rhs.prob * (infa100 - lhs.prob) <
           1LL * rhs.time_large * lhs.prob * (infa100 - rhs.prob);
  });
  int cur = 0;
  for (int i = 0; i < (n); ++i) {
    const int pre = cur;
    cur ^= 1;
    const int dt = arr[i].time_small + arr[i].time_large;
    const ll score_small = 1LL * arr[i].score_small * infa100;
    const ll score_large = score_small + 1LL * arr[i].score_large * arr[i].prob;
    for (int t = 0; t <= time; ++t) {
      dp[cur][t] = dp[pre][t];
      if (t >= arr[i].time_small) {
        auto cur_val = make_pair(
            dp[pre][t - arr[i].time_small].first + score_small,
            dp[pre][t - arr[i].time_small].second - arr[i].time_small);
        dp[cur][t] = max(dp[cur][t], cur_val);
      }
      if (t >= dt) {
        auto cur_val = make_pair(
            dp[pre][t - dt].first + score_large,
            (dp[pre][t - dt].second - arr[i].time_small) * arr[i].dprob -
                (1 - arr[i].dprob) * t);
        dp[cur][t] = max(dp[cur][t], cur_val);
      }
    }
  }
  pair<ll, double> ans;
  for (int i = 1; i <= time; ++i) {
    ans = max(ans, dp[cur][i]);
  }
  cout.setf(ios::fixed);
  cout.precision(10);
  cout << (long double)ans.first / infa100 << ' ' << -ans.second << "\n";
  return 0;
}
