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