//////////////////高精度加法///////////////////////
function jia(s1,s2:ansistring):ansistring;
var
s0,s3:ansistring;
l1,l2,i,l3:longint;
a,b,c:array[0..10000]of longint;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
if(length(s1)<length(s2))or(length(s1)=length(s2))and(s1<s2)then
begin
s0:=s1;
s1:=s2;
s2:=s0;
end;
l1:=length(s1);
l2:=length(s2);
for i:=1 to l1 do a[i]:=ord(s1[l1-i+1])-48;
for i:=1 to l2 do b[i]:=ord(s2[l2-i+1])-48;
for i:=1 to l1 do
begin
c[i]:=c[i]+a[i]+b[i];
c[i+1]:=c[i+1]+(c[i]div 10);
c[i]:=c[i]mod 10;
end;
l3:=i+1;
s3:='';
while (c[l3]=0) and (l3>1) do dec(l3);
for i:=l3 downto 1 do s3:=s3+chr(c[i]+48);
exit(s3);
end;
////////////////////高精度除法(高精度 div 2)///////////////////////
function chu(s5:string):string;
var
s3:string;
i,k:longint;
a,b,c:array[0..10000]of longint;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
a[0]:=length(s5);
b[0]:=1;
b[1]:=2;
for i:=1 to a[0] do
a[i]:=ord(s5[a[0]-i+1])-48;
for i:=a[0] downto 1 do
begin
c[i]:=(k*10+a[i])div 2;
k:=a[i] mod 2;
end;
while c[a[0]]=0 do dec(a[0]);
for i:=a[0] downto 1 do s3:=s3+chr(48+c[i]);
exit(s3);
end;
////////////////高精度乘法//////////////////////
function cheng(s5:ansistring):ansistring;
var
s3:string;
a,b,c:array[0..10000]of longint;
i,x,j:longint;
begin
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
a[0]:=length(s5);
b[0]:=a[0];
for i:=1 to a[0] do
begin
a[i]:=ord(s5[a[0]-i+1])-48;
b[i]:=a[i];
end;
for i:=1 to a[0] do
begin
x:=0;
for j:=1 to b[0] do
begin
c[i+j-1]:=a[i]*b[j]+x+c[i+j-1];
x:=c[i+j-1] div 10;
c[i+j-1]:=c[i+j-1] mod 10;
end;
c[i+j]:=x;
end;
s3:='';
c[0]:=a[0]+b[0];
while(c[c[0]]=0)and(c[0]>1)do c[0]:=c[0]-1;
for i:=c[0] downto 1 do s3:=s3+chr(c[i]+48);
exit(s3);
end;
/////////////////高精度减法////////////////////////////
function jian(str1,str2:string):string;
var
t:string;
a,b,c:array[1..300]of integer;
l,l1,l2:integer;
i:integer;
begin
t:='';
fillchar(a,sizeof(a),0);
fillchar(b,sizeof(b),0);
fillchar(c,sizeof(c),0);
l1:=length(str1);
for i:=1 to l1 do a[i]:=ord(str1[l1-i+1])-48;
l2:=length(str2);
for i:=1 to l2 do b[i]:=ord(str2[l2-i+1])-48;
l:=l1;
for i:=1 to l do
begin
if a[i]<b[i] then
begin
a[i+1]:=a[i+1]-1;
a[i]:=a[i]+10 ;
end;
c[i]:=a[i]-b[i];
end;
while c[l]=0 do l:=l-1;
for i:=l downto 1 do
t:=t+chr(48+c[i]);
exit(t);
end;