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