#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int MAXN = 1e6 + 5;
const int MOD = 1e9 + 7;
int T, N, M;
int main() {
  scanf("%d", &T);
  while (T--) {
    int x, y, a, b;
    scanf("%d%d%d%d", &x, &y, &a, &b);
    int ans = -1;
    if ((y - x) % (a + b) == 0) ans = (y - x) / (a + b);
    printf("%d\n", ans);
  }
  return 0;
}
