#include using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i=b;i--) int main() { ll L,R,M;cin>>L>>R>>M; if(M<=L) { cout<<0< t(M+1,1); for(ll i=1;i<=M;i++) { t[i]=t[i-1]*i; t[i]%=M; } ll s=0; ll now=1; for(ll i=1;i<=L;i++) { now*=t[i]; now%=M; } s+=now; s%=M; for(ll i=L+1;i<=min(R,M-1);i++) { now*=t[i]; now%=M; s+=now; s%=M; } cout<