#include <bits/stdc++.h>
using namespace std;
vector<long long int> g[100005];
long long int vis[100005];
vector<double> ans;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int 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;
}
