(defun main (&rest argv) (declare (ignorable argv)) (let* ((dp1 (make-array (list 2002 2002) :element-type 'integer :initial-element 0)) (dp2 (make-array (list 2002 2002) :element-type 'integer :initial-element 0)) (n (read)) (res 0)) (loop for i from 1 to n do (setf (aref dp1 0 i) 1)) (loop for i from 1 below n do (setf (aref dp2 (1- i) 0) 0) (loop for j from 1 to n do (setf (aref dp2 (1- i) j) (mod (+ (aref dp2 (1- i) (1- j)) (aref dp1 (1- i) j)) 1000000007))) (loop for j from 1 to n do (setf (aref dp1 i j) (mod (aref dp2 (1- i) (min n (+ j -1 (max 1 (1- i))))) 1000000007)))) (loop for i from 1 to n do (incf res (aref dp1 (1- n) i))) (dotimes (i 2002) (dotimes (j 2002) (setf (aref dp1 i j) 0))) (setf (aref dp1 0 1) 1) (loop for i from 1 below n do (setf (aref dp2 (1- i) 0) 0) (loop for j from 1 to n do (setf (aref dp2 (1- i) j) (mod (+ (aref dp2 (1- i) (1- j)) (aref dp1 (1- i) j)) 1000000007))) (loop for j from 1 to n do (setf (aref dp1 i j) (mod (aref dp2 (1- i) (min n (+ j -1 (max 1 (1- i))))) 1000000007)))) (decf res (aref dp1 (1- n) n)) (format t "~d~%" (mod res 1000000007)))) (main)