判断能否整除即可
#include <bits/stdc++.h>
using namespace std;
int x,y,a,b;
int main() {
int t;
ios::sync_with_stdio(false);
cin>>t;
while(t--) {
cin>>x>>y>>a>>b;
if((y-x)%(a+b)==0) cout<<(y-x)/(a+b)<<endl;
else cout<<-1<<endl;
}
}