#include <bits/stdc++.h>
using namespace std;
long long int maxf(long long int a, long long int c) {
  if (a < c)
    return c;
  else
    return a;
}
int main() {
  int tzz;
  cin >> tzz;
  while (tzz--) {
    long long int x, y, a1, a2;
    cin >> x >> y >> a1 >> a2;
    long long int as;
    if ((y - x) % (a1 + a2) == 0)
      as = (y - x) / (a1 + a2);
    else
      as = -1;
    cout << as << "\n";
  }
  return 0;
}
