#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
int T, x, y, a, b;
signed main() {
  T = read();
  while (T--) {
    x = read(), y = read(), a = read(), b = read();
    if ((y - x) % (a + b) == 0) {
      printf("%d\n", (y - x) / (a + b));
    } else
      puts("-1");
  }
  return 0;
}
