#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
vector<int> v, v1, v2, r, l, v3;
long long n, x, cnt, pr = 1, a, b, c, ans, mn, y, mx, m, zm, sum, z;
string s, s1, s2, s3, ss, s4, s5;
set<string> st;
set<int> st1;
map<string, int> mp, mpp;
bool tr = 0, t = 0;
long long used[1000001];
vector<int> g[N];
vector<pair<int, int>> vp;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m >> x >> y >> z;
    cnt = y + z;
    if ((x - m) % cnt == 0)
      cout << (x - m) / cnt << "\n";
    else
      cout << "-1\n";
  }
}
