// 1008. Elevator.cpp: 主項目文件。 #include "stdafx.h" #include <cstdio> int main() { int n; scanf("%d",&n); int sum=sum=5*n,pre=0; for(int i=0;i<n;i++){ int temp; scanf("%d",&temp); if(temp>pre) sum+=6*(temp-pre); else sum+=4*(pre-temp); pre=temp; } printf("%d\n",sum); return 0; }