模拟
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e2;
int n, q[N];
int main()
{
cin >> n;
for (int i = 0; i < n; i ++) cin >> q[i];
int sum = 0, nowFloor = 0;
for (int i = 0; i < n; i ++) {
if (q[i] >= nowFloor) {
sum += (q[i] - nowFloor) * 6;
sum += 5;
nowFloor = q[i];
} else {
sum += abs(q[i] - nowFloor) * 4;
sum += 5;
nowFloor = q[i];
}
}
cout << sum << endl;
return 0;
}