#include <iostream>
using namespace std;
int main()
{
int a[233],i,j,k,sum;
while(cin>>i,i){
for(j=1;j<=i;j++) cin>>a[j];
sum=k=0;
for(j=1;j<=i;j++){
if(a[j]-k>0) sum=sum+(a[j]-k)*6;
if(a[j]-k<0) sum=sum+(k-a[j])*4;
sum+=5;
k=a[j];
}
cout<<sum<<endl;
}
return 0;
}