N = int(eval(input()))

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



A=[10**6]*N



for i in range(N-1):

    if A[i] >= B[i]:

        A[i] = B[i]

    if A[i+1] >= B[i]:

        A[i+1] = B[i]



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

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



A=[0]*N



A[0]=B[0]

A[1]=B[0]



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

    A[i+1]=B[i]

    if A[i] > B[i]:

        A[i] = B[i]

print((sum(A))) 
N = int(eval(input()))
B = list(map(int, input().split()))
A = [10**6] * N
for i in range(N - 1):
    if A[i] >= B[i]:
        A[i] = B[i]
    if A[i + 1] >= B[i]:
        A[i + 1] = B[i]
print((sum(A)))

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

-A = [10**6] * N -for i in range(N - 1): -    if A[i] >= B[i]: +A = [0] * N +A[0] = B[0] +A[1] = B[0] +for i in range(1, N - 1): +    A[i + 1] = B[i] +    if A[i] > B[i]: -    if A[i + 1] >= B[i]: -        A[i + 1] = B[i]