
var f,g:text;
a:array[1..100] of longint;
s,i,n,k,d:longint;
begin assign(f,'cos.in');reset(f);
read(f,n);
for i:=1 to n do read(f,a[i]);
s:=a[n]*2+1;
for i:=n-1 downto 1 do
s:=(s+a[i])*2+1;

d:=a[n]*2-1;
for i:=n-1 downto 1 do
d:=(d+a[i])*2-1;
assign(g,'cos.out');rewrite(g);
writeln(g,s);
write(g,d);
close(f);close(g);
end.