(defconstant +mod+ 1000000007) (defun %mod-fibonacci (n m) (labels ((rec (a b i p q) (cond ((zerop i) (mod b m)) ((evenp i) (rec a b (floor i 2) (mod (+ (* p p) (* q q)) m) (mod (+ (* 2 p q) (* q q)) m))) (t (rec (mod (+ (* b q) (* a q) (* a p)) m) (mod (+ (* b p) (* a q)) m) (1- i) p q))))) (rec 1 0 n 0 1))) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read))) (format t "~d~%" (mod (* (%mod-fibonacci n +mod+) (%mod-fibonacci (1+ n) +mod+)) +mod+)))) (main)