begin
var N:Integer;
read(N);
var arr := ReadArrInteger(N);
writeln();
arr.Where(x -> x > 0).Sum.PrintLn();
arr.Where(x -> x < 0).Sum.PrintLn();
end.
//PascalABC.NET v3.5.X
begin
var N:Integer;
read(N);
var arr := ReadArrInteger(N);
writeln();
arr.Where(x -> x > 0).Sum.PrintLn();
arr.Where(x -> x < 0).Sum.PrintLn();
end.
//PascalABC.NET v3.5.X