#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int(t);
  cin >> (t);
  while ((t)--) {
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    if ((y - x) % (a + b))
      cout << -1;
    else
      cout << (y - x) / (a + b);
    cout << "\n";
  }
}
