var i,n,s:lognint;
begin
write('Nhap so km: '); readln(n);
for i:=1 to n do
begin
if (i>1) and (i<11) then s:=s + 14000
if (i>10) and (i<21) then s:=s+ 12500
if (i>20) and (i<31) then s:=s+11000;
if i>30 then s:=s+9000;
end;
write('So tien la: ',s+15000);
readln;
end.