label 1;
var  i,n,s,s1:longint;a:array[1..1000]of longint;
q,w:text;
begin
assign(q,'cos.in');
reset(q);
assign(w,'cos.out');
rewrite(w);
readln(q,n);
if n>1000 then goto 1;
for i:=1 to n do begin
read(q,a[i]);end; s:=0;
for i:=n downto 1 do begin
s:=(s+a[i])*2-1;
s1:=(s1+a[i])*2+1;
end;
writeln(w,s);
writeln(w,s1);
1:close(q);
close(w);
end.
