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