A,B,C,D=map(int,input().split()) print(min(A,D//(1+C),B//C))