#include using std::cin; using std::cout; using std::endl; using ll=long long; const ll mod=1e9+7; ll modpow(ll X,ll Y){ ll ret=1; while(Y){ if(Y%2) ret=ret*X%mod; X=X*X%mod; Y/=2; } return ret; } int main(){ ll N,M,K; cin>>N>>K>>M; ll max=1e6; assert(1<=N&&N<=max&&1<=M&&M<=max&&1<=K&&K<=max); ll sum=1,ans=0; for(int i=1;i<=N;i++){ if(K%i==0){ ans+=sum*modpow(N,N-i)%mod; ans%=mod; } sum*=(N-i); sum%=mod; } if(M==1){ cout<