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