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