N = gets[0].to_i
B = gets.split(' ').map(&:to_i)
anser = Array.new(N, 1000000)
index = 0

def min(a, b)
  if (a > b)
    b
  else
    a
  end
end
B.each do |num| 
  anser[index] = min(anser[index], num)
  anser[index + 1] = min(anser[index + 1], num)
  index += 1
end

puts anser.inject(:+)
