n = gets.chomp.to_i
b_arr = [10**5+1] + gets.chomp.split(" ").map(&:to_i) + [10**5+1]

a_arr = []
b_arr.each_cons(2) do |b1, b2|
  if b1 > b2 then
    a_arr << b2
  else
    a_arr << b1
  end
end

puts a_arr.inject(&:+)
