#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 0;
  cin >> t;
  while (t--) {
    long long int n, m, k, i, j, p, q, x, y, ans = 0, cnt = 0;
    string s;
    bool flag = false;
    long long int a, b;
    cin >> x >> y >> a >> b;
    if ((y - x) % (a + b) == 0) {
      cout << (y - x) / (a + b) << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
