模拟
#include <cstdio>
int main() {
int n, ans = 0;
scanf("%d", &n);
int l = 0, t;
while (n--) {
scanf("%d", &t);
if (l < t)
ans += 6 * (t - l);
else if (l > t)
ans += 4 * (l - t);
ans += 5;
l = t;
}
printf("%d\n", ans);
}