#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-10;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
long long t, x, y, a, b;
int main(void) {
  scanf("%d", &t);
  while (t--) {
    scanf("%lld%lld%lld%lld", &x, &y, &a, &b);
    if ((y - x) % (a + b) == 0) {
      printf("%lld\n", (y - x) / (a + b));
    } else
      puts("-1");
  }
  return 0;
}
