#include<bits/stdc++.h> using namespace std; int main(){ int t,n,b,sum,a; cin>>t; while(t){ cin>>n; sum=0; a=0; while(n){ cin>>b; if(b>a) sum+=(b-a)*6+5; if(b<a) sum+=(a-b)*4+5; a=b; n--; } cout<<sum<<endl; t--; } return 0; }