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