#include<stdio.h>

FILE *fin=fopen("cos.in","r");
FILE *fout=fopen("cos.out","w");

long n;
long a[1005];

int main()
{

fscanf(fin,"%ld\n",&n);
for(int i=0; i<n; i++)
fscanf(fin,"%ld",&a[i]);

long max=0;
long min=0;

for(int i=n-1; i>=0; i--)
{
	max=max+a[i];
	min=min+a[i];
	max=max+max+1;
	min=min+min-1;
}

fprintf(fout,"%ld\n%ld\n",max,min);

fclose(fin);
fclose(fout);
return 0;
}
