#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long x, y, a, b, q;
    cin >> x >> y >> a >> b;
    q = (abs(x - y) % (a + b));
    if (!q) {
      cout << (abs(x - y) / (a + b)) << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
