- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi and Maija are visiting their parents. While the blueberry pie is cooking in the oven, they go explore the attic. They find their old legos and decide to build castles from them. There are legos in a box numbered , the -th of which has nostalgic value to Uolevi and to Maija. The siblings then take turns in picking legos from the box and placing them to their castles. Naturally, both try to maximize the value difference between their own castle and their opponents castle.
Formally, the legos will be divided into two sets and at the end of the process. Uolevi's castle has value and Maija's castle has value . Maija tries to minimize while Uolevi tries to maximize it. Calculate if Uolevi gets to pick the first lego and both pick the legos optimally.
Input
First line contain a single integer .
The -th of the next lines contains two integers and .
Output
Output a single integer .
Constraints
Example 1
Input:
5 3 1 9 3 6 3 2 10 1 7
Output:
1
Explanation:
The sequence of picks would be:
Uolevi picks lego
Maija picks lego
Uolevi picks lego
Maija picks lego
Uolevi picks lego
Example 2
Input:
2 10 2 1 1000
Output:
-1