Task
Alice and Bob are playing a game. They have a pile of rocks. Alice makes the first move, then Bob does the second, and so on. In each turn, the player that has to move takes at least rock and maximum rocks. If one takes an odd number of rocks, then they have to pay dollars. When the pile is empty, the player who made the last move gets dollars and the other one gets dollars. After the game ends, Alice will end up with an amount of dollars, let's call it , and Bob will end up with another amount of dollars, let's call it . Knowing that they play optimally, which means Alice wants to maximize the number Bob wants to minimize this number, then find out after the game ends.
Input data
The first line will contain the values of , , , , in this order.
Output data
The first line will contain the value of the difference in dollars between Alice and Bob.
Constraints and clarifications
- For points,
- For more points, ,
- For more points,
Example
stdin
6 3 5 4 2
stdout
2