#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long x, y, a, b;
    scanf("%lld %lld %lld %lld", &x, &y, &a, &b);
    long long ans = 0;
    if ((y - x) % (a + b) == 0) {
      ans = (y - x) / (a + b);
      printf("%lld\n", ans);
    } else
      printf("-1\n");
  }
  return 0;
}
