l, r, m = map(int, input().split()) if l > m: print(0) exit() fac = 1 now = 1 for i in range(l): fac *= i + 1 fac %= m now *= fac now %= m ans = 0 for i in range(l, r+1): if now == 0: break ans += now fac *= i + 1 fac %= m now *= fac now %= m print(ans % m)