{$H+}
uses
  testlib, SysUtils, Math;

var
	ja, pa: longint;
	pturns, aturns, score: longint;
	msg: string;
	isPrelim: longint;

begin 
	pa := ouf.readlongint;
	if (pa = 0) then begin
		pturns := ouf.readlongint;
		ans.readlongint;
		aturns := ans.readlongint;
		score := min(10, round(10.0 * sqr(aturns / pturns)));
		isPrelim := ans.readlongint;
		if (isPrelim = 1) then
			quit(_ok, inttostr(score) + ' ' + inttostr(pturns) + ' turns')
		else
			quit(_rs, inttostr(score) + ' ' + inttostr(pturns) + ' turns');
	end else begin
		ouf.nextline;
		msg := ouf.readstring;
		case pa of
			1: quit(_wa, msg);
			2: quit(_pe, msg);
			3: quit(_fail, msg);
		end;
	end;
end.
