# coding: utf-8 # Your code here! a,b,c,d = [int(input()) for i in range(4)] cnt=0 bb=b//c dd=d//(c+1) print(min[a,bb,dd])