Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value in the interval.
Now she is planning to find the max value of the intervals in her array. Can you help her?
Input
First line contains an integer n (1 ≤\leq≤ n ≤\leq≤ 10510^5105)
Second line contains n integers represent the array a (−105-10^5−105 ≤\leq≤ aia_iai