#include <iostream> #include <cstdio> #include <cstring> int main() { //std::cout << "Hello, World!" << std::endl; int n , tmp=0, floor,ans=0; scanf("%d",&n); for (int i = 0; i < n; ++i) { scanf("%d",&floor); if(floor>tmp){ ans+=5+6*(floor-tmp); }else{ ans+=5+4*(tmp-floor); } tmp=floor; } printf("%d ",ans); return 0; }
ak