{$R+}
uses
	testlib, sysutils;

const
	EPS = 1e-6;

var
	n: longint;
	p, q, s, y: array [1..100] of extended;
	a, b: extended;
	ja, pa, pc: extended;
	z: extended;
	i: longint;

begin
	n := inf.readlongint;
	a := inf.readlongint;
	b := inf.readlongint;
	for i := 1 to n do begin
		p[i] := inf.readlongint;
		q[i] := inf.readlongint;
		s[i] := inf.readlongint;
	end;

	ja := ans.readreal;
	pa := ouf.readreal;

	if (ja < pa - EPS) then
		quit(_wa, format('expected: %.8f, found: %.8f', [ja, pa]));

	z := ouf.readreal;
	if (z < 0) then
		quit(_wa, 'group training length is negative');

	pc := z * b;

	for i := 1 to n do begin
		y[i] := ouf.readreal;
    	if (y[i] < 0) then
    		quit(_wa, format('individual training length of %d is negative', [i]));
    	if (q[i] * y[i] + s[i] * z < p[i] - EPS) then
    		quit(_wa, format('individual %d cannot perform his mission: %.8f < %.8f', [i, q[i] * y[i] + s[i] * z, p[i]]));
    	pc := pc + a * y[i];
	end;

	if abs(pc - pa) > EPS then
   		quit(_wa, format('individual training cost, promised: %.8f, actually: %.8f', [pa, pc]));

	if (ja > pa + EPS) then
		quit(_fail, format('expected: %.8f, found: %.8f', [ja, pa]));

	quit(_ok, format('%.8f', [pa]));
end.