N = int(eval(input()))

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

a = []

for i in range(N-1):

  if(i == 0):

    a.append(b[i])

  else:

    if(b[i] > b[i-1]):

      a.append(b[i-1])

    else:

      a.append(b[i])

  if(i == N-2):

    a.append(b[i])      

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

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

a = []

a.append(b[0])

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

  a.append(min(b[i], b[i-1]))

a.append(b[N-2])

print((sum(a)))
N = int(eval(input()))
b = list(map(int, input().split()))
a = []
for i in range(N - 1):
    if i == 0:
        a.append(b[i])
    else:
        if b[i] > b[i - 1]:
            a.append(b[i - 1])
        else:
            a.append(b[i])
    if i == N - 2:
        a.append(b[i])
print((sum(a)))

N = int(eval(input()))
b = list(map(int, input().split()))
a = []
a.append(b[0])
for i in range(1, N - 1):
    a.append(min(b[i], b[i - 1]))
a.append(b[N - 2])
print((sum(a)))

-for i in range(N - 1): -    if i == 0: -        a.append(b[i]) -    else: -        if b[i] > b[i - 1]: -            a.append(b[i - 1]) -        else: -            a.append(b[i]) -    if i == N - 2: -        a.append(b[i]) +a.append(b[0]) +for i in range(1, N - 1): +    a.append(min(b[i], b[i - 1])) +a.append(b[N - 2])