(define (fast-fibo i m) (define (helper n) (if (zero? n) (values 0 1) (let-values (((a b) (helper (quotient n 2)))) (if (even? n) (values (modulo (* a (- (* 2 b) a)) m) (modulo (+ (* a a) (* b b)) m)) (values (modulo (+ (* a a) (* b b)) m) (modulo (* b (+ (* 2 a) b)) m)))))) (values-ref (helper i) 0)) (define yuki526 (display (fast-fibo (- (read) 1) (read))))