#include<stdio.h>
#define max 105
int a[max],sum;
int main()
{
int n;
while(scanf("%d",&n)==1&&n)
{
//int tem;
sum=0;
for(int i=0;i<n;i++)
{
scanf("%d",a+i);
//a[i]=tem;
}
if(a[0]==0)sum=0;
else sum+=6*a[0]+5;
for(int j=1;j<n;j++)
{
if(a[j]>a[j-1])
sum+=6*(a[j]-a[j-1])+5;
else if(a[j]==a[j-1])sum+=5;
else sum+=4*(a[j-1]-a[j])+5;
}
printf("%d\n",sum);
}
return 0;
}
#define max 105
int a[max],sum;
int main()
{
int n;
while(scanf("%d",&n)==1&&n)
{
//int tem;
sum=0;
for(int i=0;i<n;i++)
{
scanf("%d",a+i);
//a[i]=tem;
}
if(a[0]==0)sum=0;
else sum+=6*a[0]+5;
for(int j=1;j<n;j++)
{
if(a[j]>a[j-1])
sum+=6*(a[j]-a[j-1])+5;
else if(a[j]==a[j-1])sum+=5;
else sum+=4*(a[j-1]-a[j])+5;
}
printf("%d\n",sum);
}
return 0;
}