function strtoint2(s:string):cardin

var i,len,res:word;

lame:array[1..15] of cardinal;

function mocnina(a,i:word):cardinal

var b:cardinal;

x:word;

begin

b:=a;

for x:=1 to i-1 do

begin

b:=b*a;

end;

result:=b;

end;

begin

for i:=1 to 15 do // rad

begin

lame[i]:=(mocnina(10,i)) div 10;

end;

len:=length(s);

res:=0;

for i:=1 to len do

begin

res:=res+(lame[i]*strtoint

end;

result:=res;

end;