n = int(eval(input()))

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



ans = [0]*n

ans[n-1] = b[-1]

for j in reversed(list(range(n-1))):

  b_ = b[j]

  if ans[j+1] > b_:

    ans[j+1] = b_

  ans[j] = b_

#print(ans)  

print((sum(ans)))

  

    

  

n = int(eval(input()))

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

A = [B[0]]

for i in range(n-1):

    if i != n-2:

        a = min(B[i], B[i+1])

    else:

        a = B[i]

    A.append(a)

print((sum(A)))

n = int(eval(input()))
b = list(map(int, input().split()))
ans = [0] * n
ans[n - 1] = b[-1]
for j in reversed(list(range(n - 1))):
    b_ = b[j]
    if ans[j + 1] > b_:
        ans[j + 1] = b_
    ans[j] = b_
# print(ans)
print((sum(ans)))

n = int(eval(input()))
B = list(map(int, input().split()))
A = [B[0]]
for i in range(n - 1):
    if i != n - 2:
        a = min(B[i], B[i + 1])
    else:
        a = B[i]
    A.append(a)
print((sum(A)))

-b = list(map(int, input().split())) -ans = [0] * n -ans[n - 1] = b[-1] -for j in reversed(list(range(n - 1))): -    b_ = b[j] -    if ans[j + 1] > b_: -        ans[j + 1] = b_ -    ans[j] = b_ -# print(ans) -print((sum(ans))) +B = list(map(int, input().split())) +A = [B[0]] +for i in range(n - 1): +    if i != n - 2: +        a = min(B[i], B[i + 1]) +    else: +        a = B[i] +    A.append(a) +print((sum(A)))