#pragma GCC target("avx2") #pragma GCC optimize("O3") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; using ull = unsigned long long; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; } //mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); constexpr long long INF = 1LL << 60; constexpr int inf = 1000000007; constexpr long long mod = 1000000007LL; //constexpr long long mod = 998244353; constexpr int MAX = 1100000; int power(int x, int n, int p) { if (n == 0) { return 1; } if (n % 2 == 0) { return power(1LL * x * x % p, n / 2, p); } else { return 1LL * x * power(x, n - 1, p) % p; } } const int N = 10'000'000; int cnt[N + 1]; int fcnt[N + 1]; bool done[N + 1]; int f[N + 1]; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int a, b, n; cin >> a >> b >> n; for (int i = 1; i <= N; i++) { for (int j = i; j <= N; j += i) { if(a<= j and j <= b) cnt[i] += 1; } } for (int i = N; i >= 1; i--) { if (cnt[i] == 0) continue; if (done[cnt[i]]) fcnt[i] = f[cnt[i]]; else { fcnt[i] = power(cnt[i], n, mod - 1); done[cnt[i]] = true; f[cnt[i]] = fcnt[i]; } for (int j = i + i; j <= N; j += i) { fcnt[i] -= fcnt[j]; if (fcnt[i] < 0) fcnt[i] += mod - 1; } //cout << i << " " << fcnt[i] << endl; } int res = 1; for (int i = 1; i <= N; i++) { res = 1LL * res * power(i, fcnt[i], mod) % mod; } cout << res << "\n"; }