#include #include using namespace std; // #define DISABLE_PRINT #if defined(ENABLE_PRINT) && !defined(DISABLE_PRINT) #define P(...) fprintf(stderr, __VA_ARGS__) #define LP fprintf(stderr, "L: %d\n", __LINE__) #else #define P(...) ((void)0) #define LP ((void)0) #endif #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define ALL(x) x.begin(), x.end() using ll = long long; using ull = unsigned long long; const int INF = 1100100100; const ll INFLL = 1100100100100100100; using mint = atcoder::dynamic_modint<0>; int main() { ll L, R, M; cin >> L >> R >> M; mint::set_mod(M); auto ans = [&]() -> mint { mint f = 1; mint x = 1; mint ans = 0; for (ll i = 0; i < L; ++i) { f *= (i + 1); x *= f; if (x == 0) break; } ans += x; LP; if (x.val() == 0) return ans; LP; for (ll i = 0; i < (R - L); ++i) { f *= (L + 1 + i); x *= f; ans += x; if (x.val() == 0) break; } LP; return ans; }(); cout << ans.val() << endl; return 0; }