uses crt;
const fi='dulieu.inp'
var f1:text;
a:array[1..100]of integer;
n,i,t1,t2:integer;
begin
clrscr;
assign(f1,fi); reset(f1);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
t1:=0;
t2:=0;
for i:=1 to n do
begin
if a[i]>0 then t1:=t1+a[i];
if a[i]<0 then t2:=t2+a[i];
end;
writeln('Tong cac so duong la: ',t1);
writeln('Tong cac so am la: ',t2);
close(f1);
readln;
end.