# Your code here!

n = gets.to_i
nums = [0]*n
data = gets.split.map &:to_i
data.push(0)

(0..n-2).each do |i|
    if i==n-2
        work = data[i]
    elsif data[i] <= data[i+1]
        work = data[i]
    else data[i+1] <= data[i]
        work = data[i+1]
    end
    
    if i==0
        nums[i] = work
    elsif nums[i+] >= work
        nums[i+1] = work
        nums[i] = work
    end
    
end
sum = 0
nums.each do |num|
  sum += num
end
 
puts sum