n = gets.to_i
ar = gets.chomp.split(' ')
result = []
 
for i in 0..(n-1) do
  ins = n - i - 1
  if i == (n-1)
    result.push(ar[ins].to_i)
  else
    if ar[ins].to_i > ar[ins-1].to_i
      result.push(ar[ins].to_i)
    else
      result.push(ar[ins-1].to_i)
    end
  end
end
 
result.each do |n|
  a += result[n]
end
puts a