program spring;
var a,b,c,d:array[1..20000]of integer;
i,j,k,l,t:longint;
s:ansistring;
yes:boolean;
begin
assign(input,'div.in');
assign(output,'div.out');
reset(input);
rewrite(output);
readln(s);
l:=length(s);
k:=0;
for i:=l downto 1 do begin
k:=k+1;
val(s[i],a[k],j);
end;
readln(s);
t:=length(s);
k:=0;
for i:=t downto 1 do begin
k:=k+1;
val(s[i],b[k],j);
end;
fillchar(d,sizeof(d),0);
k:=0;
i:=l;
repeat
if k<>0 then for j:=k downto 1 do d[j+1]:=d[j];
d[1]:=a[i];
k:=k+1;
repeat
if k>t then yes:=true
else if k=t then begin
for j:=k downto 1 do begin
if d[j]>b[j] then begin
yes:=true;
break;
end;
if d[j]<b[j] then begin
yes:=false;
break;
end;
if (j=1)and(d[j]=b[j]) then begin
fillchar(d,sizeof(d),0);
c[i]:=c[i]+1;
yes:=false;
end;
end;
end
else yes:=false;
if yes then begin
for j:=1 to k do begin
if d[j]>=b[j] then d[j]:=d[j]-b[j]
else begin
d[j+1]:=d[j+1]-1;
d[j]:=d[j]+10;
d[j]:=d[j]-b[j];
end;
end;
c[i]:=c[i]+1;
end;
while (k>0)and(d[k]=0) do k:=k-1;
until yes=false;
i:=i-1;
until i=0;
i:=200;
while (c[i]=0)and(i>1) do i:=i-1;
for j:=i downto 1 do write(c[j]);
close(input);
close(output);
end.