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