A, B, N = map(int, input().split()) mod = 10**9 + 7 dp = [0] * (B + 1) for i in range(B, 0, -1): for j in range(2 * i, B + 1, i): dp[i] -= dp[j] dp[i] %= mod v = B//i - (A - 1)//i dp[i] += pow(v, N, mod) dp[i] %= mod ans = 1 for i in range(1, B + 1): ans *= pow(i, dp[i], mod) ans %= mod print(ans)