program mn;
uses crt;
var s,i,n,j:integer;
h:longint;
BEGIN
ClrScr;
for i:=1 to 9 do
for j:=1 to 9 do
begin
h:=j+40+i*100+2000+40000;
if (h mod 27 = 0)and(s=0)
then begin
s:=1;
writeln(h);
end;
readln;
END.