program sramoc;
var
k,m:integer;
i,j:longint;
s:int64;
st:string;
flag:boolean;
begin
assign (input,'sramoc.in');
reset (input);
readln (k,m);
close (input);
assign (output,'sramoc.out');
rewrite (output);
for i:=1 to maxlongint do begin
s:=m*i;flag:=true;
str(s,st);
for j:=1 to length(st) do if ord(st[j])-48>=k then begin
flag:=false;
break;
end;
if flag then begin
writeln (s);
close (output);
halt;
end;
end;
close (output);
end.