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