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