using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (l, r, m) = (c[0], c[1], c[2]); var f = new long[m]; f[1] = 1; var dp = new long[m]; dp[1] = 1; for (var i = 2; i < m; ++i) { f[i] = f[i - 1] * i % m; dp[i] = dp[i - 1] * f[i] % m; } var ans = 0L; for (var i = l; i <= r && i < m; ++i) ans = (ans + dp[i]) % m; WriteLine(ans); } }