#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int testcase;
  cin >> testcase;
  for (int tc = 0; tc < testcase; tc++) {
    double x, y, a, b;
    cin >> x >> y >> a >> b;
    double ans = (y - x) / (a + b);
    if (ceil(ans) == floor(ans))
      cout << (int)ans << "\n";
    else
      cout << "-1"
           << "\n";
  }
  return 0;
}
