#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvvl vector #define vvl vector> #define VV(a, b, c, d) vector>(a, vector(b, c)) #define VVV(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define re(c, b) for(ll c=0;c0){ if(b%2) ret *= num; num = num * num; b /= 2; } }else{ while(b>0){ if(b%2) ret = (ret*num)%p; num = (num*num)%p; b /= 2; } } return ret; } int main(int argc, char const *argv[]) { //gcdは1~b ll a, b, n;std::cin >> a >> b >> n; ll P = 1000000007; vll cnt(b+1, 0);//gcdがi for(ll g=b;g>=2;g--){ //全てgの倍数 ll tmp = (b/g) - ((a-1)/g); tmp = mpow(tmp, n, P); cnt[g] = tmp; for(ll k=2*g;k<=b;k+=g) cnt[g] = (cnt[g] - cnt[k] + P)%P; } ll ans = 1; for(ll g=2;g<=b;g++) ans = (ans * mpow(g, cnt[g], P))%P; std::cout << ans << '\n'; return 0; }