#include<bits/stdc++.h>
using namespace std;

int main()
{
	int k,n;
    cin>>k>>n;
  	int arr[k];
    int len = arr.size();
    if(len<=1)
    {
		cout<<n<<endl;
    }
   else
   {
    int sum = 0;
  	for(int i=0;i<len;i++)
    {
		sum+=min(a[i],a[i+1]);
    }
  cout<<sum<<endl;
   }
}
