#include using namespace std; int M; int f(long N) { int ret=0; int fac=1; int val=1; for(int n=1;n<=N&&n>L>>R>>M; cout<<(f(R)-f(L-1)+M)%M<