# coding: utf-8
class Case03

  def initialize
  end

  def show
    p self.instance_variables
        .map{ |sym| [sym, self.instance_variable_get(sym)] }
        .to_h
  end
  
  # 実行する
  def execute
    read
    solve
    output
  end

  def read
    @n = gets.chomp.to_i
    @b = gets.chomp.split.map(&:to_i)
  end

  def solve
    @result = @b[0]
    2.upto(@n-1) do |i|
      @result += [@b[i-2], @b[i-1]].min
    end
    @result += @b[-1]
  end
  
  def output
    puts @result
  end

end

Case03.new.execute if $0 == __FILE__

