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