#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, cs = 1;
  scanf("%lld", &tc);
  while (tc--) {
    long long a, b, c, d;
    scanf("%lld %lld", &a, &b);
    scanf("%lld %lld", &c, &d);
    if ((b - a) % (c + d) == 0)
      cout << (b - a) / (c + d) << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
