#include #include #define vll vector using namespace std; typedef long long int ll; #define P 1000000007 #define Q 1000000006 inline ll mpow(ll a, ll x, ll p){ ll ret = 1, num = a; for(;x;){ if(x&1) ret = (ret*num)%p; num=(num*num)%p; x>>=1; } return ret; } int main() { ll a, b, n, ans = 1; scanf("%lld %lld %lld", &a, &b, &n); a--; vector pm(b+1, 1); for(int i=2;i<=b;i++){ if(!pm[i]) continue; for(int j=2*i;j<=n;j+=i) pm[j] = 0; } for(int g=2;g<=b;g++){ if(!pm[g]) continue; ll tmp = b/g - a/g; ll y = g; while(y<=b){ ll num = mpow(tmp, n, P-1); ans = (ans * mpow(g, num, P))%P; y *= g; } } printf("%lld\n", ans); }