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

    println(op140c(n, b))
}

fun op140c(n: Int, b: List<Int>): Int {
    return (mutableListOf(b[0]) + b.mapIndexed { index, i ->
        when (index) {
            b.lastIndex -> b.last()
            else -> Math.min(b[index], b[index + 1])
        }
    }).sum()
}
