(defun facd (n p) (prog (pp count) (setq pp p) (setq count 0) loop (if (> pp n) (return count) (setq count (mod (+ count (/ (- n (mod n pp)) pp)) 1000000007)) ) (setq pp (* pp p)) (go loop) ) ) (defun factorial (n) (if (= n 1) 1 (mod (* n (factorial (- n 1))) 1000000007) ) ) (defun rui (n p) (if (= n 1) p (mod (* p (rui (- n 1) p)) 1000000007) ) ) (defun solve (n p) (setq fac (factorial n)) (mod (* (facd n p) (rui fac fac)) 1000000007) ) (princ (solve (read) (read)))