using System; using System.Linq; namespace _526 { class Program { static void Main(string[] args) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); long[] dp = new long[x[0]]; dp[0] = 0; dp[1] = 1; for (int i = 2; i < x[0]; i++) { dp[i] = (dp[i - 2] + dp[i - 1]) % x[1]; } Console.WriteLine(dp[x[0] - 1]); } } }