#include <bits/stdc++.h>
using namespace std;
class ATwoRabbits {
 public:
  void solve(std::istream &cin, std::ostream &cout) {
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i) {
      int64_t x, y, a, b;
      cin >> x >> y >> a >> b;
      if (abs(x - y) % (a + b) != 0) {
        cout << -1 << endl;
      } else {
        cout << abs(x - y) / (a + b) << endl;
      }
    }
  }
};
int main() {
  ATwoRabbits solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
