#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    int t;
    if ((x - y) % (a + b) == 0)
      cout << abs((x - y) / (a + b)) << endl;
    else
      cout << "-1" << endl;
  }
}
