unittest
{
	assert( [ "3", "2 5" ].parse.expand.solve == 9 );
	assert( [ "2", "3" ].parse.expand.solve == 6 );
	assert( [ "6", "0 153 10 10 23" ].parse.expand.solve == 53 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto bs = input.front.split.to!( long[] );
	return tuple( n, bs );
}

auto solve( long n, long[] bs )
{
	bs ~= long.max;
	auto ans = bs.front;
	auto a = bs.front;
	for( auto i = 0L; i + 1 < bs.length; i++ )
	{
		a = min( bs[ i ], bs[ i + 1 ] );
		ans += a;
	}
	return ans;
}
