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