#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, a, b, c, d, n, t, l, f, x, y;
  vector<long long int> v, s;
  vector<long long int>::iterator it, ki;
  map<pair<long long int, long long int>, long long int> ma, sa;
  string st;
  cin >> t;
  for (i = 1; i <= t; i++) {
    cin >> x >> y >> a >> b;
    c = a + b;
    d = y - x;
    if (d % c == 0) {
      cout << d / c << endl;
    } else
      cout << -1 << endl;
  }
}
