# Try to Win, C++

    #include<iostream>
    using namespace std;
    int main()
    {
    	int td, dl, tp, pl;
    	cin>>td>>dl>>tp>>pl;
    	if (pl == 1)
    	{
    		cout << dl;
    		return 0;
    	}
    	else
    	{
    		int sn = dl / pl;
    		int si = td / tp;
    		if (sn > si + 1)
    		{
    			cout << sn - 1;
    			return 0;
    		}
    		if (sn = si + 1)
    		{
    			cout << sn;
    			return 0;
    		}
    		if (sn == si)
    		{
    			cout << sn;
    			return 0;
    		}
    		if (sn < si)
    		{
    			cout << si;
    			return 0;
    		}
    
    	}
    	return 0;
    }