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