#include<iostream>using namespace std;int main(){ int a,b,x,y; cin >> a >> b >> x >> y; if (b >= a * x && b <= a * y && (b-a*x)%(y-x)==0 && ((b - a * x) / (y - x) <= a)) { cout << (b - a * x) / (y - x); } else { cout << "-1"; } return 0;}