#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9;
const double EPS = 1e-9;
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a > b ? 1 : -1; }
struct prob {
  int sm_s, l_s, sm_t, l_t;
  double fail;
  bool operator<(const prob &b) const {
    double x = (l_t * (1 - fail) * b.fail) + (l_t + b.l_t) * (1 - b.fail);
    double y = (b.l_t * (1 - b.fail) * fail) + (l_t + b.l_t) * (1 - fail);
    return x < y;
  }
};
int n, t;
vector<prob> v;
pair<long long, double> dp[1234][1578];
pair<long long, double> clc(int idx, int total) {
  if (total < 0) return make_pair(-1e18, 1e100);
  if (idx < 0)
    return total == 0 ? make_pair(0.0, 0.0) : make_pair(-1e18, 1e100);
  pair<long long, double> &ans = dp[idx][total];
  if (ans == ans) return ans;
  ans = clc(idx - 1, total);
  pair<long long, double> cur = clc(idx - 1, total - v[idx].sm_t);
  cur.first += v[idx].sm_s * (long long)1e6;
  cur.second += v[idx].sm_t;
  if (cur.first > ans.first ||
      (cur.first == ans.first && dcmp(cur.second, ans.second) < 0))
    ans = cur;
  cur = clc(idx - 1, total - v[idx].sm_t - v[idx].l_t);
  cur.first += v[idx].sm_s * (long long)1e6;
  cur.second += v[idx].sm_t;
  cur.first +=
      v[idx].l_s * ((long long)1e6 - (long long)(1e6 * v[idx].fail + EPS));
  cur.second = cur.second * v[idx].fail + total * (1 - v[idx].fail);
  if (cur.first > ans.first ||
      (cur.first == ans.first && dcmp(cur.second, ans.second) < 0))
    ans = cur;
  return ans;
}
int main() {
  cin >> n >> t;
  v.resize(n);
  for (int i = 0; i < n; i++)
    cin >> v[i].sm_s >> v[i].l_s >> v[i].sm_t >> v[i].l_t >> v[i].fail;
  sort(v.begin(), v.end());
  pair<long long, double> ans = make_pair(0, 0);
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= t; i++) {
    pair<long long, double> cur = clc(n - 1, i);
    if (cur.first > ans.first ||
        (cur.first == ans.first && dcmp(cur.second, ans.second) < 0))
      ans = cur;
  }
  printf("%.9lf %.9lf", ans.first / 1e6, ans.second);
  return 0;
}
