//the elevator may stay at the same floor several times.
#include<stdio.h>
int main(){
int i,n,last=0,now,total=0;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&now);
if(now>last){
total=(now-last)*6+5+total;
last=now;
}
else if(now<last){
total=(last-now)*4+5+total;
last=now;
}
else{
total=total+5;
}
}
printf("%d\n",total);
return 0;
}
阅读全文