def main(): n = int(input()) arr = [0] + list(map(int, input().split())) ans = 0 for i, a in enumerate(arr): ans += i * (n - i + 1) * a print(ans) if __name__ == "__main__": main()