#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int x, y, a, b, z, c;
  cin >> n;
  while (n--) {
    cin >> x >> y >> a >> b;
    z = y - x;
    c = a + b;
    if (z % c == 0)
      cout << z / c << endl;
    else
      cout << "-1" << endl;
  }
  return 0;
}
