program PascalGuru;
type cisla=1..1000000;
function summa(chislo:integer):integer;
var s:integer;
begin
s:=0;
while (chislo > 0) do
begin
s:=s + (chislo mod 10);
chislo:=chislo div 10
end;
summa:=s
end;
{-----------------------------------------------------}
var i,n:cisla;
rezult:integer;
begin
write('n= '); readln(n);
rezult:=0;
for i:=1 to 1000000 do
if summa(i)=n then begin rezult:=i; break; end;
writeln(rezult);
readln;
end.