program ideone;
var
x1,x2:integer;
max: record
x1,x2,value: integer;
end;
begin
max.value := 0;
for x1 := 60 downto 0 do
for x2 := 80 downto 0 do
if (15*x1 + 10*x2) <= 950 then
if (40*x1 + 20*x2) > max.value then
begin
max.value := 40*x1 + 20*x2;
max.x1 := x1;
max.x2 := x2;
end;
writeln(max.value, ' ', max.x1, ' ', max.x2);
end.
cHJvZ3JhbSBpZGVvbmU7CnZhciAKCXgxLHgyOmludGVnZXI7CgltYXg6IHJlY29yZCAKCQl4MSx4Mix2YWx1ZTogaW50ZWdlcjsKCWVuZDsKYmVnaW4KCW1heC52YWx1ZSA6PSAwOwoJZm9yIHgxIDo9IDYwIGRvd250byAwIGRvCgkJZm9yIHgyIDo9IDgwIGRvd250byAwIGRvCgkJCWlmICgxNSp4MSArIDEwKngyKSA8PSA5NTAgdGhlbgoJCQkJaWYgKDQwKngxICsgMjAqeDIpID4gbWF4LnZhbHVlIHRoZW4KCQkJCWJlZ2luCgkJCQkJbWF4LnZhbHVlIDo9IDQwKngxICsgMjAqeDI7CgkJCQkJbWF4LngxIDo9IHgxOwoJCQkJCW1heC54MiA6PSB4MjsKCQkJCWVuZDsKCQoJd3JpdGVsbihtYXgudmFsdWUsICcgJywgbWF4LngxLCAnICcsIG1heC54Mik7CmVuZC4=