#include <bits/stdc++.h>
using namespace std;
vector<int> v1, v2;
int main() {
  int i, j, k, a, b, n, x, y;
  int t;
  cin >> t;
  while (t--) {
    cin >> x >> y >> a >> b;
    if (y - x >= 0 && (y - x) % (a + b) == 0)
      cout << (y - x) / (a + b) << "\n";
    else
      cout << -1 << "\n";
  }
}
