#include <cstdio>

//#define CHECK_TIME

#ifdef CHECK_TIME
#include <ctime>
#endif

const char InFile[]="cos.in";
const char OutFile[]="cos.out";
const int MaxN=1024;
const int HUGEINT_SIZE=512;

FILE *fin=fopen(InFile,"r");
FILE *fout=fopen(OutFile,"w");
 
typedef int HUGEINT[HUGEINT_SIZE];

int N,nr[MaxN];
HUGEINT MIN,MAX;

inline void set0(HUGEINT A)
{
	for(register int i=1;i<=A[0];++i)
	{
		A[i]=0;
	}
	A[0]=0;
}

inline void cpy(HUGEINT A, HUGEINT B)
{
	set0(A);
	for(register int i=0;i<=B[0];++i)
	{
		A[i]=B[i];
	}
}

inline void add(HUGEINT A, int B)
{
	int i,t;
	for(t=B,i=1;i<=A[0] || t;++i,t/=10)
	{
		A[i]=(t+=A[i])%10;
	}
	A[0]=i-1;
}

inline void sub(HUGEINT A, int B)
{
	if(A[0]<1)
	{
		return;
	}
	else if(A[0]==1 && A[1]<B)
	{
		return;
	}
	int i,t;
	for(t=0,i=1;i<=A[0];++i)
	{
		int x;
		if(i>1)
		{
			x=0;
		}
		else
		{
			x=B;
		}
		A[i]+=(t=(A[i]-=(x+t))<0)*10;
	}
	for(;!A[A[0]];--A[0]);
}

inline void mul(HUGEINT A, int B)
{
	int i,t;
	for(t=0,i=1;i<=A[0] || t;++i,t/=10)
	{
		A[i]=(t+=A[i]*B)%10;
	}
	A[0]=i-1;
}

inline void write(HUGEINT A)
{
	for(register int i=A[0];i>0;--i)
	{
		fprintf(fout,"%d",A[i]);
	}
	if(A[0]==0)
	{
		fprintf(fout,"0");
	}
}

int main()
{
#ifdef CHECK_TIME
	int start=clock();
#endif
	fscanf(fin,"%d",&N);
	for(register int i=1;i<=N;++i)
	{
		fscanf(fin,"%d",&nr[i]);
	}
	fclose(fin);
	
	for(register int i=N;i>=1;--i)
	{
		add(MIN,nr[i]);
		mul(MIN,2);
		sub(MIN,1);
		
		add(MAX,nr[i]);
		mul(MAX,2);
		add(MAX,1);
	}
	
 	write(MAX);
	fprintf(fout,"\n");
	write(MIN);
	fclose(fout);
#ifdef CHECK_TIME
	printf("Time: %lf",(double)(clock()-start)/(double)(CLOCKS_PER_SEC));
#endif
	return 0;
}
