n= gets.to_i
ary = gets.split.map(&:to_i)
if n==2
  ans = Array.new(n, ary[0])
  puts ans.inject(&:+)
  exit
else
  ans = Array.new(n,0)
end
ans[-1] = ary[-1]
ary.each_with_index do |k, i|
  if i==0
    ans[0] = ary[0]
    next
  end
  if ary[i-1]<=ary[i]
    ans[i] = ary[i-1]
  else
    ans[i] = ary[i]
  end
end
puts ans.inject(&:+)