#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, a, b, res;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> a >> b;
    if (y < x)
      res = -1;
    else {
      int dif = y - x;
      int sum = a + b;
      if (dif % sum == 0) {
        res = dif / sum;
      } else
        res = -1;
    }
    cout << res << endl;
  }
}
