#include using namespace std; constexpr 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; unordered_map mp; vector X(B + 1, 0); for (int g = B; g > 0; g--) { int a = (A - 1) / g, b = B / g; if (mp.find(b - a) == mp.end()) { X[g] = pow(b - a, N, mod - 1); mp[b - a] = X[g]; } else { X[g] = mp[b - a]; } for (int i = 2 * g; i < B + 1; i += g) { X[g] -= X[i]; if (X[g] < 0) X[g] += mod - 1; } res = INT64_C(1) * res * pow(g, X[g], mod) % mod; } cout << res << '\n'; return 0; }