program sramoc(input,output);
var
a:array[1..100]of integer;
k,m:longint;
i,ans:longint;
function judge(x:longint):boolean;
var
i:longint;
s:string;
begin
judge:=true;
str(x,s);
for i:=1 to length(s) do
if ord(s[i])-ord('0')>=k then
begin
judge:=false;
exit;
end;
end;
begin
assign(input,'sramoc.in');
reset(input);
readln(k,m);
close(input);
ans:=0;
for i:=1 to maxlongint do
begin
ans:=ans+m;
if judge(ans)=true then break;
end;
assign(output,'sramoc.out');
rewrite(output);
writeln(ans);
close(output);
end.