(define (main args) (let* ([a (read)] [b (read)] [c (read)] [d (read)]) (print (min a (quotient b c) (quotient d (+ c 1))))) 0)