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

const
b: integer=10; {basis}

var
r,rep: integer;
h,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 r:=1 to rep do
begin
valst:='                    ';
k:=m+n+1;
c:=0;
for h:=1 to m+n-1 do
    begin
    u:=c;
    for j:=n downto 1 do
        begin
        i:=m-h+n-j+1;
        if (i>0) and (i<=m) then
            begin
            val(auxst[i],s,err);
            val(argst[j],t,err);
            u:=u+s*t;
{    writeln('h=',h,' i=',i,' j=',j,' k=',k,' s=',s,' t=',t,' c=',c,' u=',u);}
            end;
        end;
    c:=u div b;
    u:=u mod b;
    k:=k-1;
    valst[k]:=Chr(48+u);
{    writeln('h=',h,' i=',i,' j=',j,' k=',k,' s=',s,' t=',t,' c=',c,' u=',u);
    writeln('VALST = ',valst);}
    end;
if c>0 then
    begin
    k:=k-1;
    valst[k]:=Chr(48+c);
    end;
end;
writeln('VALST = ',valst);
end.
