Maximum Subsegment Sum is a classical problem. When Rikka first saw this problem, she was still an outsider of competitive programming, and now, she has become a problem setter of this grand event.
Therefore, Rikka decides to set a problem about Maximum Subsegment Sum. Given an array x of length m, its maximum subsegment sum mss(A) is defined as: mss(A)=max_1≤i≤j≤m(∑_k=ijx_k).
Now, given an integer array A of length n, Rikka wants you to calculate the sum of the maximum subsegment sums of all subsegments of A, i.e. ∑_1≤i≤j≤nmss(\[A_i,…,A_j]).
The first line contains a single integer n (1≤n≤105).
The second line contains n integers A_i (−109≤A_i≤109).
Output a single line with a single integer, the answer. The answer can be very large, therefore, you are only required to output the answer modulo 264.
More formally, suppose the answer is x, you are required to find the smallest non-negative integer y satisfying y=x+k×264 for some integer k.