a = int(input())
b = input()
b = b.split()
c = 0
d = 0
c = []
for x in range(a - 1):
if d == 0:
f = int(b.pop(0))
e = f + int(b.pop(0))
c.append(f)
c.append(e)
d = 1
else:
e = e + int(b.pop(0))
c.append(e)
total = 0
for x in range(a):
total = total + int(c.pop(0))
print(total)