Elevator
#include<stdio.h>
int main(){
int temp,next,priod=0,time=0;
while(scanf("%d",&temp)!=EOF && temp){
time=0,priod=0;
while(temp--){
scanf("%d",&next);
if(next>priod){
time+=(next-priod)*6+5;
priod=next;
}else if(next==priod){
time=time+5;
priod=next;
}else{
time+=(priod-next)*4+5;
priod=next;
}
}
printf("%d\n",time);
}
}