#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int main(){ ll L, R, M, now=1, ans=0; cin >> L >> R >> M; vector a(1e6); a[0] = 1; for (ll i=1; i<1e6; i++) a[i] = (a[i-1] * i) % M; for (int i=1; i<1e6; i++){ now *= a[i]; now %= M; if (L <= i && i <= R) ans = (ans + now) % M; } cout << ans << endl; return 0; }