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