#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll t;
  cin >> t;
  while (t--) {
    ll x, y, a, b;
    cin >> x >> y >> a >> b;
    y -= x;
    x = 0;
    if (y % (a + b))
      cout << -1 << '\n';
    else
      cout << y / (a + b) << '\n';
  }
}
