var o,q:text;
        m,i:integer;
        n,c:int64;
        a:array[1..1000] of integer;
        begin
assign(o,'cos.in');
reset(o);
readln(o,m);
for i:=1 to m do
read(o,a[i]);
n:=0;
assign(q,'cos.out');
rewrite(q);
for i:=m downto 1 do
begin
        c:=a[i]+n;
        n:=2*c+1;
end;
writeln(q,n);
n:=0;
for i:=m downto 1 do
begin
        c:=a[i]+n;
        n:=2*c-1;
end;
write(q,n);
close(q);
close(o);
end.
