#include <bits/stdc++.h>
const unsigned int MOD = 1000000007;
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long x, y, a, b;
    cin >> x >> y >> a >> b;
    long long ans = -1;
    if ((y - x) % (a + b) == 0) ans = (y - x) / (a + b);
    cout << ans << endl;
  }
  return 0;
}
