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