Dystopian III
Dystopian Land of Fives Part 3: A Portal To A Magical Land
For a long time, Brooke has been seeking a special portal to escape the dystopia on her land. After searching and being on the run for several years, she has finally found the portal. However, for the portal to work she has to solve the required problem on its keypad.
The keypad consists of  lines of integers. Each line 
 where 
 consists of 
 integers. There are two rules for picking the right integer from each line:
- For every line where is even, pick the highest integer from that line. 
- For every line where is odd, pick the lowest integer from that line. 
The final result should be the sum of all the integers picked from each line.
Brooke is nervous and does not want to get this wrong. She needs your help to write a program which will pick the right numbers according to the rules and add them accordingly.
Input
The first line of input consists of two integers  and 
.
The next  lines consist of 
 integers 
.
Output
Print the sum of integers picked from each line.
Examples
Input 1
3 5
3 10 2 5 5
2 -1 3 4 -5
10 15 100 2 -2Output 1
4Explanation
According to the rules, pick 2, 4, -2 and add them together.
Comments