function split(s, c)
  if string.find(s, c) == nil then
    return { s }
  end

  local cs = {}
  
  local lastPos = 0
  for part, p in string.gmatch(s, "(.-)" .. c .. "()") do
    table.insert(cs, part)
    lastPos = p
  end

  table.insert(cs, string.sub(s, lastPos))

  return cs
end

n=io.read("*n")
b={}

for i=1, n-1 do
  table.insert(b, i, io.read("*n"))
end

ans=0

a1=0
a2=0

for i=1, n-1 do
  a1=a2
  if i == 1 then
    a1=b[i]
    a2=b[i]
  end
  a2=b[i]
  if b[i+1] == nil then
    a2=b[i]
  elseif b[i] > b[i+1] then
    a2=b[i+1]
  end

  ans = ans + math.max(a1, a2)
end

ans = ans + b[1]

print(ans)