local l,r,m=io.read("*n","*n","*n") if r>m then r=m end local f,g,h=1,1,0 for n=1,r do f=f*n%m g=g*f%m if n>=l then h=h+g end end print(h%m)