Help me in solving LBJ201 problem

My issue

My code

import java.util.Scanner;

class Codechef
{
	public static void main (String[] args)
	{
	    Scanner read = new Scanner(System.in);
	    int t = read.nextInt();
	    for(int i=0; i<t; i++){
	        int A = read.nextInt();
	        int C = read.nextInt();
	        // Use your sub-components below this line to solve the problem
	        int B= (A+C)/2;
	        
	         if(B>0 && B%2==0){
	            System.out.println(B);
	        }
	        else{
	            System.out.println(" -1");
	        }
	      
	            
	        }

	        
	    }
	}


Learning course: Java for problem solving - 1
Problem Link: CodeChef: Practical coding for everyone

WHY MY CODE GIVING 4 FOR THE INPUTS 4 & 5 ,INSTED OF -1?

@sudeepgowdru10
your code is failing for case A=6,C=7 it will give 6 instead of -1
the condition of valid answer is both should be even or odd else it would be -1