Consider a sequence of integers in arithmetical progression: A, A+B, A+2B, A+3B, ... A+NB.
Systematically pick any two adjacent numbers, and randomly replace them by their sum or difference. Keep at this until only one number remains. Is this number odd or even? What's the largest value this number can attain?
The second part first: the maximum is the sum of all numbers: NA + ½N(N+1)B.
The first part second: when you sum/subtract two numbers, the parity of the sum/difference is the same, so the parity of the last number equals the parity of the sum of all numbers. If the sum we found above is odd/even, the last number will be odd/even.