```
def maxRotateFunction(self, A):
vector_sum = sum(A)
length =len(A)
last = 0
for i in range(0, length):
last += A[i] * i
max_so_far = last
for i in range(1, length):
last = last + vector_sum - length * A[-i]
max_so_far = max(max_so_far, last)
return max_so_far
```