#include #include #define vll vector using namespace std; typedef long long int ll; #define P 1000000007 #define Q 1000000006 int main() { ll a, b, n, ans = 1; scanf("%lld %lld %lld", &a, &b, &n); a--; ll cnt[b+1]; ll ret, num, x; for(int g=b;g>=2;g--){ ll tmp = b/g - a/g; ret = 1, num = tmp, x = n; for(;x;){ if(x&1) ret = (ret*num)%Q; num=(num*num)%Q; x>>=1; } cnt[g] = ret; for(int k=2*g;k<=b;k+=g) cnt[g] -= cnt[k]; ll t = abs(cnt[g])/Q + 1; cnt[g] = (cnt[g] + t*Q)%Q; ret = 1, num = g, x = cnt[g]; for(;x;){ if(x&1) ret = (ret*num)%P; num=(num*num)%P; x>>=1; } ans = (ans * ret)%P; } printf("%lld\n", ans); }