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