#include<iostream>
using namespace std;
int main(){
int n;
while (cin >> n){
if (n == 0)break;
int a, time = n * 5, temp = 0;
while (n--) {
cin >> a;
if (a > temp) time += (a - temp) * 6;
else time += (temp - a) * 4;
temp = a;
}
cout << time << endl;
}
return 0;
}
杭电1008
最新推荐文章于 2021-09-03 10:16:52 发布