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