#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long a, b, x, y;
  cin >> x >> y >> a >> b;
  long long t = (y - x) / ((a + b));
  if (t >= 0) {
    if (((y - x) % (a + b)) == 0) {
      cout << t << endl;
      return;
    }
  }
  cout << -1 << endl;
  return;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
