using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace YukiCoder { class Program { static void Main(string[] args) { var va = Console.ReadLine().Split().Select(int.Parse).ToArray(); int Fa = 0; int Fb = 1; int Fc = 0; for (int i = 2; i < va[0]; i++) { Fc = Fb + Fa; Fa = Fb; Fb = Fc; } Console.WriteLine(Fc % va[1]); Console.ReadLine(); } } }