const lineList = require('fs').readFileSync('/dev/stdin','utf8').trim().split('\n')

const n = parseInt(lineList[0])
const b = lineList[1].split(' ').map(e => parseInt(e))
const aList = []

aList.push(b[0])
for(var i=0;i<b.length;i++) {
  aList.push(b[i])

  if(aList[i-1] > b[i]) {
    aList[i-1] = b[i]
  }
}

const answer = aList.reduce((a,e) => a + e, 0)

console.log(answer)
