Program proizv;
var i, n, s:integer; a:array[1..40] of integer;
begin
s:=0;
writeln('Введите кол-во элементов');
readln(n);
for i:=1 to n do
begin
a[i]:=random(100)-40;
writeln(a[i],' ');
end;
for i:=1 to n do
begin
a[i]:=a[i-1]+a[i-2];
s:=s+a[i];
end;
writeln('s=',s);
end.