```
def maxRotateFunction(self, A):
currentvalue = 0
maxvalue = 0
n = len(A)
sumOfA = sum(A)
for i in range(n):
currentvalue += i*A[i]
maxvalue = currentvalue
for i in range(n):
currentvalue += sumOfA - A[n-i-1]*n
maxvalue = max(maxvalue,currentvalue)
return maxvalue
```