(defconstant +mod+ 1000000007) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (dp (make-array (list (1+ n) 4) :initial-element 0))) (setf (aref dp 0 0) 1) (loop for i from 1 to n do (loop for j from 1 below 4 when (>= i j) do (dotimes (k 4) (when (/= j k) (incf (aref dp i j) (aref dp (- i j) k)))) (setf (aref dp i j) (mod (aref dp i j) +mod+)))) (format t "~d~%" (mod (loop for i from 0 below 4 sum (aref dp n i)) +mod+)))) (main)