A,B,N=map(int,input().split()) isPrime=[True]*(B+1) isPrime[0]=isPrime[1]=False for i in range(2,B+1): if not isPrime[i]: continue for j in range(i*i,B+1,i): isPrime[j]=False MOD=10**9+7 ans=1 for p in range(B+1): if not isPrime[p]: continue pe=p while pe<=B: ans*=pow(p,pow(B//pe-(A-1)//pe,N,MOD),MOD) ans%=MOD pe*=p print(ans)