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