You are given an array A of size N. You need to make a array from this array. A array is an array of size , where P is some positive integer.
To make the array, you can concatenate some distinct sized and non overlapping sub arrays of A where each subarray can be of size between 1 to P. Distinct sized subarrays means that you cannot take more than 1 subarray whose size is same.
Also let the starting positions of subarray of size i be denoted by . Then the following should hold:
for all valid i.
Your goal is to maximise the sum of elements in array. Can you find the maximum sum possible?
Input:
First line of input contains an integer N denoting the size of A. Next line contains N space separated integers denoting the array A.
Output:
Print the maximum sum of the array that you can make from the given array A.
Constraints: