N = gets.to_i
B = gets.split.map(&:to_i)
B << Float::INFINITY
A = Array.new(N, Float::INFINITY)

B.each_cons(2).each_with_index do |(b1, b2), idx|
  A[idx] = [A[idx], b1, b2].min
  A[idx + 1] = [A[idx + 1], b1, b2].min
end

puts A.inject(:+)
