#include <bits/stdc++.h>
using namespace std;
int t;
int x, y, a, b;
int main() {
  cin >> t;
  for (int ct = 1; ct <= t; ct++) {
    cin >> x >> y >> a >> b;
    int ab = a + b;
    int xy = abs(x - y);
    if (xy % ab == 0)
      cout << xy / ab << '\n';
    else
      cout << -1 << '\n';
  }
  return 0;
}
