Program HOC24;
var i,m: integer;
t: longint;
a: array[1..1000] of integer;
begin
write('Nhap so phan tu M: '); readln(m);
for i:=1 to m do
begin
write('Nhap so thu ',i,': '); readln(a[i]);
end;
for i:=1 to m do if a[i]<0 then t:=t+a[i];
write('Tong la: ',t);
readln
end.