#include <bits/stdc++.h>
using namespace std;
struct note {
  long double p;
  int t1, t2, x1, x2;
  long double x;
} a[1005];
int n, t;
int tot;
struct note1 {
  long long poi;
  long double t;
} f[1005][1605];
bool cmp(note i, note j) { return i.x < j.x; }
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &a[i].x1, &a[i].x2, &a[i].t1, &a[i].t2);
    cin >> a[i].p;
    a[i].x = a[i].p / (1 - a[i].p) * a[i].t2;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    for (int j = t; j >= 0; j--) {
      f[i][j] = f[i - 1][j];
      if (j >= a[i].t1) {
        long long np = f[i - 1][j - a[i].t1].poi + a[i].x1 * (long long)1000000;
        double nt = f[i - 1][j - a[i].t1].t + a[i].t1;
        if (np > f[i][j].poi || np == f[i][j].poi && nt < f[i][j].t) {
          f[i][j].poi = np;
          f[i][j].t = nt;
        }
      }
      if (j >= a[i].t1 + a[i].t2) {
        long long np = f[i - 1][j - a[i].t1 - a[i].t2].poi +
                       a[i].x1 * (long long)1000000 +
                       a[i].x2 * round((1 - a[i].p) * (long long)1000000);
        double nt = (a[i].t1 + f[i - 1][j - a[i].t1 - a[i].t2].t) * a[i].p +
                    j * (1 - a[i].p);
        if (np > f[i][j].poi || np == f[i][j].poi && nt < f[i][j].t) {
          f[i][j].poi = np;
          f[i][j].t = nt;
        }
      }
    }
  long long ans1 = 0;
  double ans2 = 0;
  for (int i = 0; i <= t; i++) {
    if (f[n][i].poi > ans1 || ans1 == f[n][i].poi && ans2 > f[n][i].t) {
      ans1 = f[n][i].poi;
      ans2 = f[n][i].t;
    }
  }
  double pri = 1.0 * ans1 / 1000000;
  printf("%.12lf %.12lf", pri, ans2);
  return 0;
}
