var a:array[1..100]of integer;i,n,s1,s2:integer;beginreadln(n);for i:=1 to n doreadln(a[i]);s1:=0;s2:=0;for i:=1 to n doif i mod 2=0 then s1:=s1+a[i];if i mod 2=1 then s2:=s2+a[i];writeln(s1,' ',s2);end.
var a:array[1..100]of integer;
i,n,s1,s2:integer;
begin
readln(n);
for i:=1 to n do
readln(a[i]);s1:=0;s2:=0;
for i:=1 to n do
if i mod 2=0 then s1:=s1+a[i];
if i mod 2=1 then s2:=s2+a[i];
writeln(s1,' ',s2);
end.