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