N = int(eval(input()))

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

A = [0]*(len(B)+1)

A[0] = B[0]

A[1] = B[0]

cnt = 0

for i, x in enumerate(B):

    if i != 0:

        A[i + 1] = B[i]

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

    cnt += A[i]

cnt += A[-1]

print(cnt)
n = int(eval(input()))

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

cnt = b[0]

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

  cnt += min(b[i-1], b[i])

print((cnt + b[-1]))
N = int(eval(input()))
B = list(map(int, input().split()))
A = [0] * (len(B) + 1)
A[0] = B[0]
A[1] = B[0]
cnt = 0
for i, x in enumerate(B):
    if i != 0:
        A[i + 1] = B[i]
        A[i] = min(A[i], B[i])
    cnt += A[i]
cnt += A[-1]
print(cnt)

n = int(eval(input()))
b = list(map(int, input().split()))
cnt = b[0]
for i in range(1, n - 1):
    cnt += min(b[i - 1], b[i])
print((cnt + b[-1]))

-N = int(eval(input())) -B = list(map(int, input().split())) -A = [0] * (len(B) + 1) -A[0] = B[0] -A[1] = B[0] -cnt = 0 -for i, x in enumerate(B): -    if i != 0: -        A[i + 1] = B[i] -        A[i] = min(A[i], B[i]) -    cnt += A[i] -cnt += A[-1] -print(cnt) +n = int(eval(input())) +b = list(map(int, input().split())) +cnt = b[0] +for i in range(1, n - 1): +    cnt += min(b[i - 1], b[i]) +print((cnt + b[-1]))