import sys

input = sys.stdin.readline



N = int(eval(input()))

B = list(map(int, input().split()))



C = [None] * N

C[0] = B[0]

C[-1] = B[-1]



for i in range(1, N - 1):

    C[i] = min(B[i - 1], B[i])



print((sum(C)))
N = int(eval(input()))

B = list(map(int, input().split()))



A = [None] * N

A[0] = B[0]

A[-1] = B[-1]



for i in range(1, len(B)):

    A[i] = min(B[i], B[i - 1])



print((sum(A)))

import sys

input = sys.stdin.readline
N = int(eval(input()))
B = list(map(int, input().split()))
C = [None] * N
C[0] = B[0]
C[-1] = B[-1]
for i in range(1, N - 1):
    C[i] = min(B[i - 1], B[i])
print((sum(C)))

N = int(eval(input()))
B = list(map(int, input().split()))
A = [None] * N
A[0] = B[0]
A[-1] = B[-1]
for i in range(1, len(B)):
    A[i] = min(B[i], B[i - 1])
print((sum(A)))

-import sys - -input = sys.stdin.readline -C = [None] * N -C[0] = B[0] -C[-1] = B[-1] -for i in range(1, N - 1): -    C[i] = min(B[i - 1], B[i]) -print((sum(C))) +A = [None] * N +A[0] = B[0] +A[-1] = B[-1] +for i in range(1, len(B)): +    A[i] = min(B[i], B[i - 1]) +print((sum(A)))