a,b,c,d = map(int,input().split()) ret = 0 for i in range(1, a+1): if i*c<=b and i*(c+1)<=d: ret += 1 else: break print(ret)