#include <bits/stdc++.h>
using namespace std;
long long n, m, x, y, cnt, bnt;
string s, cal, kcal;
bool ok = false, mtest = false;
char ch;
deque<long long> A, B;
vector<bool> vc;
void solve() {
  int a, b;
  cin >> x >> y >> a >> b;
  y -= x;
  if (y % (a + b) == 0)
    cout << y / (a + b) << '\n';
  else
    cout << -1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  while (n--) solve();
}
