#944. Stocks: many trades
You get the price of a stock for each day. You may buy and sell as many times as you want (one share at a time). Find the largest profit.
### Input
The first line has n, the second line has n integers separated by spaces.
### Output
A number.
Examples
Input
3 52 2 18
Output
16
Input
12 20 66 63 49 44 36 89 33 69 42 58 39
Output
151
💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.