#include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll MOD = 1000000007; template T pow(T a, ll n) { T ans = 1; T tmp = a; for (int i = 0; i <= 60; i++) { ll m = (ll)1 << i; if (m & n) { ans *= tmp; ans %= MOD; } tmp *= tmp; tmp %= MOD; } return ans; } template T pow_(T a, ll n) { T ans = 1; T tmp = a; for (int i = 0; i <= 60; i++) { ll m = (ll)1 << i; if (m & n) { ans *= tmp; ans %= (MOD-1); } tmp *= tmp; tmp %= (MOD-1); } return ans; } bool is_prime[10000001]; vector ps; void init(){ for(int i = 2; i <= 10000000; i++){ is_prime[i] = true; } for(int i = 2; i*i <= 10000000; i++){ if(is_prime[i]){ for(int j = 2; i*j <= 10000000; j++){ is_prime[i*j] = false; } } } for(int i = 2; i <= 10000000; i++){ if(is_prime[i]) ps.push_back(i); } } ll A, B, N; // [A, B]のnで割り切れる個数 ll count(ll n){ return B/n-(A-1)/n; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; init(); cin >> A >> B >> N; ll ans = 1; for(ll n : ps){ ll tmp = n; while(tmp <= B){ ll c = pow_(count(tmp), N)-pow_(count(tmp*n), N); // ll c = pow(count(tmp), N)-pow(count(tmp*n), N); // if(c > 0) cout << n << ' ' << count(tmp) << ' ' << count(tmp*n) << ' ' << c << endl; c = (c%(MOD-1)+(MOD-1))%(MOD-1); ans *= pow(tmp, c); ans %= MOD; tmp *= n; } } cout << ans << endl; }