#include<iostream> usingnamespacestd ; intmain(){ int N ; cin >> N ; int temp = 0 ; int now = 0 ; int sum = N *5; for(int i = 0 ; i< N ; i++) { cin>> temp ; int flag = (temp-now)>0 ? 1 : -1 ; sum += (5+flag*1) * (flag)* (temp-now ) ; now =temp ; } cout << sum <<endl ; }