#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int x = 0;
  while (ch > '9' || ch < '0') {
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x;
}
const int maxn = 200010;
int n, w;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    if ((y - x) % (a + b) == 0) {
      cout << (y - x) / (a + b) << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
