#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long x, y, a, b, cpt = 0;
    cin >> x >> y >> a >> b;
    cout << ((y - x) % (a + b) == 0 ? (y - x) / (a + b) : -1) << endl;
  }
  return 0;
}
