#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t -- ){
int x,y,a,b;
scanf("%d %d %d %d",&x,&y,&a,&b);
double ans = 1.0 * abs(y - x) / (a + b);
int t = ans;
if(t == ans){
printf("%d\n",t);
}
else puts("-1");
}
return 0;
}