#include <bits/stdc++.h>
using namespace std;
int T, n, m, k;
const int maxn = int(1e5 + 5);
int x, y, a, b;
int main() {
  cin >> T;
  while (T--) {
    cin >> x >> y >> a >> b;
    int t = (y - x) % (a + b);
    if (t == 0)
      cout << (y - x) / (a + b);
    else
      cout << -1;
    cout << '\n';
  }
}
