# yukicoder My Practice # author: Leonardone @ NEETSDKASU require 'matrix' n, m = gets.strip.split.map &:to_i mat = Matrix[[1, 1], [1, 0]] ** n p mat[1, 1] % m