#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c, ans, boby, apu;
  cin >> n;
  while (n--) {
    cin >> a >> b >> c >> ans;
    boby = b - a;
    apu = c + ans;
    if (boby % apu == 0) {
      cout << boby / apu << endl;
    } else
      cout << "-1" << endl;
  }
  return 0;
}
