include
using namespace std;
int main()
{
int t;
cin >> t;
while (t–)
{
int a, c;
cin>>a>>c;
int b = a+c; // store the sum of int a and c
if(b%2==0){ // check whether the sum is even or not
cout<<b/2<<endl; // print average value of user input
}
else{ // print -1 if average value is float/double datatype
cout<<-1<<endl;
}
}
return 0;
}