#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<ld, ld>;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
str Tout[2] = {"NO", "YES"};
str tout[2] = {"No", "Yes"};
int main() {
  int t;
  cin >> t;
  while (t--) {
    ll x, y, a, b;
    cin >> x >> y >> a >> b;
    if ((y - x) % (a + b)) {
      cout << "-1\n";
      continue;
    } else
      cout << (y - x) / (a + b) << "\n";
  }
  return 0;
}
