io = STDIN
n=io.gets.to_i
b=io.gets.split.map(&:to_i)
a=Array.new(n,0)
if n==2
  puts b[0]*2
else
  b.unshift(0)
  a[0]=b[1]
  (1..(n-1)).each do |i|
    a[i-1]=b[i] if b[i-1]>=b[i]
    a[i-1]=b[i] if [a[i-1],a[i]].max >= b[i]
    a[i]=b[i]   if [a[i-1],a[i]].max >= b[i]
    a[i]=b[i]   if i==n-1 && a[i]<b[i]
  end
  puts a.inject(:+)
end
