cf 447 div2 Ralph And His Magic Field

i have understood the formula for it but i am unable to understand that when k=-1 and n and m have different parity i the answer will be -1 but for k=1 answer will not be -1 why?
[problem][1]
[1]: http://codeforces.com/contest/894/problem/B

cf 447 div2 Ralph And His Magic Field

i have understood the formula for it but i am unable to understand that when k=-1 and n and have different parity i answer will be -1 but for k=1 answer will not be -1 why?
[problem][1]
[1]: http://codeforces.com/contest/894/problem/B