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