class Solution:
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
profit = 0;
for i in xrange(1, len(prices)):
if prices[i] > prices[i-1]:
profit += prices[i] - prices[i-1]
return profit