#include using namespace std; const int MOD = 1000000007; template int pow(int x, T n, int mod = std::numeric_limits::max()) { int res = 1; while (n > 0) { if (n & 1) res = static_cast(res) * static_cast(x) % mod; x = static_cast(x) * static_cast(x) % mod; n >>= 1; } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int A, B, N; cin >> A >> B >> N; int res = 1, prev = 0; vector P(B + 1, 0); for (int g = B; g > 0; g--) { int x = B / g - (A - 1) / g; if (x == prev) { P[g] = P[g + 1]; } else { P[g] = pow(x, N, MOD - 1); } for (int i = 2 * g; i < B + 1; i += g) { P[g] -= P[i]; if (P[g] < 0) P[g] += MOD - 1; } res = static_cast(res) * pow(g, P[g], MOD) % MOD; } cout << res << '\n'; return 0; }