#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int a, b, x, y, counter = 0, hate = 0, flag = 1;
    cin >> x >> y >> a >> b;
    hate = (y - x) / (a + b);
    if ((y - x) % (a + b) != 0) flag = 0;
    if (hate > 0 && flag)
      cout << hate << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
