#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, l, m, n, o, p;
  cin >> p;
  while (p--) {
    cin >> j >> k >> l >> m;
    n = k - j;
    o = l + m;
    if (n % o == 0) {
      cout << n / o << endl;
    } else
      cout << "-1" << endl;
  }
  return 0;
}
