(define (fast-fibo i m) (define (helper n a b) (cond ((zero? n) a) ((even? n) (helper (- n 1) (modulo (* a (- (* 2 b) a)) m) (modulo (+ (* a a) (* b b)) m))) (else (helper (- n 1) (modulo (+ (* a a) (* b b)) m) (modulo (* b (+ (* 2 a) b)) m))))) (helper i 0 1)) (define (main args) (print (fast-fibo (- (read) 1) (read))) 0 )