fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val Bs = readLine()!!.split(" ").map(String::toInt)

    val As = Array(n) { Int.MAX_VALUE }

    Bs.withIndex().forEach { b ->
        if (b.value < As[b.index]) As[b.index] = b.value
        As[b.index + 1] = b.value
    }

    println(As.sum())
}