#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long ab = b - a;
    long long cd = c + d;
    if (ab % cd == 0) {
      cout << (b - a) / (c + d) << "\n";
    } else {
      cout << "-1\n";
    }
  }
}
