uses crt;
const fi='mang.txt'
var a:array[1..100]of integer;
i,n,t1,t2:integer;
f1:text;
begin
clrscr;
assign(f1,fi); rewrite(f1);
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then
begin
t1:=t1+a[i];
end;
if a[i]<0 then
begin
t2:=t2+a[i];
end;
end;
writeln(f1,'Tong cac so duong la: ',t1);
writeln(f1,'Tong cac so am la: ',t2);
if abs(t1)>abs(t2) then writeln(f1,'Gia tri tuyet doi cua ',t1,' lon hon gia tri tuyet doi cua ',t2)
else if abs(t1)<abs(t2) then writeln(f1,'Gia tri tuyet doi cua ',t2,' lon hon gia tri tuyet doi cua ',t1)
else writeln(f1,'Gia tri tuyet doi cua ',t1,' bang gia tri tuyet doi cua ',t2);
close(f1);
end.