package yukicoder; import java.util.Scanner; public class No526 { private int n, m; public static void main(String[] args) { No526 main = new No526(); main.run(); } private void run() { Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = sc.nextInt(); System.out.println(fibonacci(n) % m); } private int fibonacci(int n) { if(n == 1) return 0; if(n == 2) return 1; return fibonacci(n - 1) + fibonacci(n - 2); } }