program ml;
{ for the development of the TRAC ML (multiply) function
  07/15/86 }

const
b: integer=10; {basis}

var
h,rep: integer;
i,j,k,l,m,n: integer;
s,t,u,c: integer;
err: integer;
auxst,argst: string[10];
valst: string[21];

begin
write('Rep='); readln(rep);
write('Enter  sss*ttt  '); readln(valst);
m:=pos('*',valst)-1;   auxst:=copy(valst,1,m); writeln('AUX = ',auxst);
n:=length(valst)-m-1;  argst:=copy(valst,m+2,n); writeln('ARG = ',argst);
for h:=1 to rep do
begin
valst:='                    ';
l:=21;
for j:=n downto 1 do
    begin
    c:=0;
    val(argst[j],t,err);
    for i:=m downto 1 do
        begin
        val(auxst[i],s,err);
        k:=i+j;
        if k<l then
            u:=0
        else
            val(valst[k],u,err);
        u:=s*t+u+c;
        c:=u div b;
        u:=u mod b;
        valst[k]:=Chr(48+u);
{        writeln('i=',i,' j=',j,' k=',k,' l=',l,' s=',s,' t=',t,' c=',c,' u=',u);}
        end;
    if c>0 then
        begin
        k:=k-1;
        valst[k]:=Chr(48+c);
        end;
    l:=k;
    end;
end;
writeln('VALST = ',valst);
end.
