#include <bits/stdc++.h>
using namespace std;
string s;
int a[100001];
int main() {
  int t;
  cin >> t;
  int x, y, a, b;
  for (int i = 0; i < t; i++) {
    cin >> x >> y >> a >> b;
    int ans1 = (y - x) / (a + b);
    double ans2 = (double)(y - x) / (double)(a + b);
    if (ceil(ans2) == ans1 && floor(ans2) == ans1) {
      cout << ans1 << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
