#include <bits/stdc++.h>
using namespace std;
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int N;
int S1[1005];
int S2[1005];
int T1[1005];
int T2[1005];
long double P[1005];
long double Ps[1005];
long double Val[1005];
int Order[1005];
bool Cmp(int X, int Y) { return Val[X] < Val[Y]; }
pair<long double, long double> F[10005];
int Time;
void Init() {
  Get(N);
  Get(Time);
  for (int i = 1; i <= N; i++) {
    Get(S1[i]);
    Get(S2[i]);
    Get(T1[i]);
    Get(T2[i]);
    double X;
    scanf("%lf", &X);
    P[i] = X;
    Ps[i] = 1 - P[i];
    Order[i] = i;
    Val[i] = (P[i] * T2[i]) / (1 - P[i]);
  }
  std::sort(Order + 1, Order + N + 1, Cmp);
}
pair<long double, long double> Ans;
void Work() {
  for (int k = 1, i; k <= N; k++) {
    i = Order[k];
    for (int j = Time; j >= 0; j--) {
      if (j >= T1[i]) {
        if (F[j] <
            make_pair(F[j - T1[i]].first + S1[i], F[j - T1[i]].second - T1[i]))
          F[j] = make_pair(F[j - T1[i]].first + S1[i],
                           F[j - T1[i]].second - T1[i]);
      }
      if (j >= T1[i] + T2[i]) {
        pair<long double, long double> Ans0 =
            make_pair(F[j - T1[i] - T2[i]].first + S1[i] + S2[i] * Ps[i],
                      (F[j - T1[i] - T2[i]].second - T1[i]) * P[i] - (j)*Ps[i]);
        if (F[j] < Ans0) F[j] = Ans0;
      }
    }
  }
  for (int i = 0; i <= Time; i++) {
    if (Ans < F[i]) Ans = F[i];
  }
}
void Output() {
  double Ans1 = Ans.first;
  double Ans2 = -Ans.second;
  printf("%.13lf %.13lf\n", Ans1, Ans2);
}
int main() {
  Init();
  Work();
  Output();
  return 0;
}
