import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner s = new Scanner(System.in); String[] str = s.nextLine().split(" "); int n = Integer.parseInt(str[0]); int m =Integer.parseInt(str[1]); long fib1; if(n == 0){ fib1=0%m; } else if(n == 1){ fib1= 1%m; } else{ int n_1 = 1; int n_2 = 1; int ans = 0; for(int i = 3;i