#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int test;
  cin >> test;
  while (test--) {
    long long int a, b, x, y, t = 0;
    cin >> x >> y >> a >> b;
    if (x > y)
      cout << "-1" << endl;
    else if (x == y)
      cout << "0" << endl;
    else if ((y - x) < (a + b))
      cout << "-1" << endl;
    else {
      long long int t = 0;
      a = a + b;
      b = 0;
      t = (y - x) / (a + b);
      if ((y - x) % (a + b) == 0)
        cout << t << endl;
      else
        cout << "-1" << endl;
    }
  }
  return 0;
}
