uses crt;
var c,x,y,d1,j,s,i,n:longint;
function kt(k:longint):longint;
var d,l:longint;
begin
d:=0;
while k<>0 do
begin
l:=k mod 10;
k:=k div 10;
d:=d+l;
end;
kt:=d;
end;
begin
clrscr;
write('Nhap c: ');readln(c);
write('Nhap x: ');readln(x);
s:=1; d1:=1;
for i:=1 to c do
s:=s*10;
for y:=1 to c-1 do
d1:=d1*10;
for j:=s-1 downto d1 do
if kt(j)=x then begin write(j); break; end;
readln
end.