A, B, N = map(int, input().split()) mod = 10 ** 9 + 7 mod2 = 10 ** 9 + 6 B2 = B // 2 B21 = B2 + 1 cnt = [0] * max(A, B21) A -= 1 ret = 1 for i in range(B, max(B2, A), -1): ret = ret * i % mod lastBi = lastval = 0 tmpprod = 1 for i in range(max(B2, A), A, -1): Bi = B // i if Bi != lastBi: ret = ret * pow(tmpprod, lastval, mod) % mod tmpprod, lastBi = i, Bi lastval = pow(Bi, N, mod2) for n in range(i + i, B21, i): lastval -= cnt[n] lastval = (lastval - Bi + Bi // 2) % mod2 else: tmpprod = tmpprod * i % mod cnt[i] = lastval ret = ret * pow(tmpprod, lastval, mod) % mod lastAi = lastBi = lastval = 0 tmpprod = 1 for i in range(A, 1, -1): Bi = B // i Ai = A // i if Ai == Bi: continue if Bi != lastBi or Ai != lastAi: ret = ret * pow(tmpprod, lastval, mod) % mod tmpprod, lastAi, lastBi = i, Ai, Bi lastval = pow(Bi - Ai, N, mod2) for n in range(i + i, B21, i): lastval -= cnt[n] lastval = (lastval - Bi + Bi // 2) % mod2 else: tmpprod = tmpprod * i % mod cnt[i] = lastval ret = ret * pow(tmpprod, lastval, mod) % mod print(ret)