#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long x, y;
    double a, b;
    cin >> x >> y >> a >> b;
    double diff = y - x;
    double s = diff / (b + a);
    if (((long)s) == s)
      cout << ((long)s) << '\n';
    else
      cout << -1 << '\n';
  }
}
