#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
int main()
{
int n,i,pre,ans,x;
while(scanf("%d",&n)!=EOF)
{
ans = pre = 0;
for(i = 0;i<n;i++)
{
scanf("%d",&x);
ans+=5;
if(x>pre)ans+=(x-pre)*6;
else ans+=(pre-x)*4;
pre = x;
}
printf("%d\n",ans);
}
return 0;
}
pat1008 Elevator
最新推荐文章于 2019-10-09 20:28:31 发布