#include using namespace std; int main() { int a, b, c, d, can = -1; cin >> a >> b >> c >> d; for(int i = 0; i <= a; i++) if (i + i*c <= d && b >= i*c) can++; cout << (can > a ? a : can) << endl; return 0; }