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