import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Data.Char

main = do
    n <- readLn :: IO Int
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    print $ (VU.head xs) + (VU.last xs) + VU.sum (VU.zipWith min xs $ VU.tail xs)