n = int(input()) a = [i for i in map(int, input().split())] ans = 0 for i in range(1,n): for j in range(i+1,n+1): ans += a[i-1]+a[j-1] print(ans)