#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 7;
int n, t, Num[N];
struct YYZ {
  int S1, S2, t1, t2;
  double p1;
} A[N];
struct NFO {
  long double S, t;
  friend bool operator<(NFO A, NFO B) {
    return (((A.S - B.S) > 0 ? (A.S - B.S) : -(A.S - B.S)) <= 1e-7) ? A.t > B.t
                                                                    : A.S < B.S;
  }
  friend NFO operator+(NFO A, NFO B) { return (NFO){A.S + B.S, A.t + B.t}; }
  inline NFO Inc(int i, int j) {
    return (NFO){S + A[i].S1 + (1 - A[i].p1) * A[i].S2,
                 A[i].p1 * (t + A[i].t1) + (1 - A[i].p1) * j};
  }
} Dp[N];
inline NFO Max(NFO A, NFO B) { return A < B ? B : A; }
int main() {
  scanf("%d%d", &n, &t);
  for (int i = (1), iLimit = (n); i <= iLimit; (++(i)))
    scanf("%d%d%d%d%lf", &A[i].S1, &A[i].S2, &A[i].t1, &A[i].t2, &A[i].p1),
        Num[i] = i;
  sort(Num + 1, Num + 1 + n, [](int a, int b) {
    YYZ C = A[a], B = A[b];
    return C.p1 * C.t2 / (C.p1 - 1) > B.p1 * B.t2 / (B.p1 - 1);
  });
  for (int k = (1), kLimit = (n); k <= kLimit; (++(k))) {
    int i = Num[k];
    for (int j = (t), jLimit = (A[i].t1); j >= jLimit; (--(j))) {
      Dp[j] =
          Max(Dp[j], Dp[j - A[i].t1] + (NFO){(double)A[i].S1, (double)A[i].t1});
      if (j >= A[i].t1 + A[i].t2)
        Dp[j] = Max(Dp[j], Dp[j - A[i].t1 - A[i].t2].Inc(i, j));
    }
  }
  NFO Ans = (NFO){0, 2147483647};
  for (int i = (0), iLimit = (t); i <= iLimit; (++(i))) Ans = Max(Ans, Dp[i]);
  cout << fixed << setprecision(15) << Ans.S << ' ';
  cout << fixed << setprecision(15) << Ans.t << ' ';
  return 0;
}
