let N=stdin.ReadLine() |> int
let B=stdin.ReadLine().Split() |> Array.map int
let rec f i sum=
    if i=N then sum
    elif i=0 then f (i+1) (sum+B.[i]) 
    elif i=N-1 then f (i+1) (sum+B.[N-2])
    else B.[(i-1)..i] |>Array.min |> fun x->f (i+1) (sum+x)
f 0 0 |> stdout.WriteLine