#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int c = 0;
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    if ((y - x) / (a + b) > 0 && (y - x) % (a + b) == 0)
      cout << (y - x) / (a + b) << "\n";
    else
      cout << "-1" << '\n';
  }
  return 0;
}
