A share has a known price on each of n days. You may complete as many buy-then-sell trades as you like, holding at most one share at a time. Each time you sell, you pay a fixed transaction fee. A trade's net gain is therefore (sell price) minus (buy price) minus fee.
Return the maximum total profit. Doing nothing yields a profit of 0.
Input format
Line 1: two integers n and fee.
Line 2: n space-separated non-negative integers, the daily prices (present whenever n >= 1).
Output format
A single integer: the maximum total net profit.
Constraints
- 1 <= n <= 100000
- 0 <= fee <= 1000000000
- 0 <= price <= 1000000000