#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a[1005], b[1005], x[1005], y[1005];
  cin >> t;
  for (int i = 0; i < t; i++) cin >> x[i] >> y[i] >> a[i] >> b[i];
  for (int i = 0; i < t; i++) {
    if ((y[i] - x[i]) % (a[i] + b[i]) != 0)
      cout << "-1" << endl;
    else {
      int p = (y[i] - x[i]) / (a[i] + b[i]);
      cout << p << endl;
    }
  }
  return 0;
}
