Help me in solving LB01B problem

My issue

i am not understand this one…is there any another way to learn this one

Learning course: Logic Building in Python
Problem Link: CodeChef: Practical coding for everyone

The logic is if A and C both are even or both are odd then answer will be (A+C)/2 .
else the answer will be -1;