#include <bits/stdc++.h>
using namespace std;
long long power(long long k, long long d) {
  long long ans = 0;
  while (d > 1) {
    if (d % k != 0) return -1;
    d = d / k;
    ans++;
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if ((b - a) % (c + d) == 0) {
      cout << (b - a) / (c + d);
    } else
      cout << -1;
    cout << endl;
  }
  return 0;
}
