#include<iostream> |
using namespace std; |
int main(){ |
int m; |
int n; |
int pre; |
int total; |
for (cin>>m; m != 0; cin>>m){ |
cin>>n; |
pre = n; |
total = n * 6; |
total = total + 5; |
for ( int i = 1; i < m; i++){ |
cin>>n; |
if (n > pre){ |
total = total + 6 * (n - pre); |
pre = n; |
} else if (n < pre){ |
total = total + 4 * (pre - n); |
pre = n; |
} |
total = total + 5; |
} |
cout<<total<<endl; |
} |
} |