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