(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(declaim (ftype (function * (values simple-bit-vector &optional)) make-prime-table))
(defun make-prime-table (size)
  "Erzeugt die Primzahlentabelle 0 zu SIZE-1."
  (declare (optimize (speed 3) (safety 1)))
  (let ((dict (make-array size :element-type 'bit :initial-element 1)))
    (setf (sbit dict 0) 0
          (sbit dict 1) 0)
    (loop for even-num from 4 below size by 2
          do (setf (sbit dict even-num) 0))
    (loop for p from 3 to (ceiling (sqrt size)) by 2
          when (= 1 (sbit dict p))
          do (loop for composite from (+ p p) below size by p
                   until (>= composite size)
                   do (setf (sbit dict composite) 0)))
    dict))

(defun decompose-to-pow-table (num prime-table)
  (declare (optimize (speed 3))
           (simple-bit-vector prime-table))
  (let ((factor-table (make-array (length prime-table)
                                  :element-type 'uint16
                                  :initial-element 0)))
    (when (= 1 (sbit prime-table 2))
      (setf (aref factor-table 2)
            (loop while (evenp num)
                  count t
                  do (setf num (ash num -1)))))
    (loop for prime from 3 to (min num (- (length prime-table) 1)) by 2
          when (= 1 (sbit prime-table prime))
          do (setf (aref factor-table prime)
                   (loop with quot and rem
                         do (setf (values quot rem) (floor num prime))
                         while (zerop rem)
                         count t
                         do (setf num quot)))
          finally (return factor-table))))

;; Based on alexandria
(declaim (inline %multiply-range))
(defun %multiply-range (i j)
  (labels ((bisect (j k)
             (declare (type (integer 1 #.most-positive-fixnum) j k)
                      (values integer))
             (if (< (- k j) 8)
                 (multiply-range j k)
                 (let ((middle (+ j (truncate (- k j) 2))))
                   (* (bisect j middle)
                      (bisect (+ middle 1) k)))))
           (multiply-range (j k)
             (declare (type (integer 1 #.most-positive-fixnum) j k))
             (do ((f k (* f m))
                  (m (1- k) (1- m)))
                 ((< m j) f)
               (declare (type (integer 0 (#.most-positive-fixnum)) m)
                        (type unsigned-byte f)))))
    (bisect i j)))

(defun factorial (n)
  (%multiply-range 1 n))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* ((n (read)))
    (if (= n 1)
        (println 1)
        (let* ((p-table (make-prime-table (1+ n)))
               (fact (factorial n))
               (f-table (decompose-to-pow-table fact p-table)))
          (println
           (loop for pow across f-table
                 with res = 1
                 unless (zerop pow)
                 do (setf res (mod (* res (+ pow 1)) +mod+))
                 finally (return res)))))))

#-swank(main)


Measured memory_bytes: 28128