(define main
  (lambda (n m)
      (* 1000 (quotient (quotient n 1000) m))))

(print (main (read) (read)))