#include using namespace std; using lint = long long; lint MOD = 1000000007; lint modpow(lint a, lint b, lint mod) { lint ans = 1, now = a; for (int i = 0; i < 60; i++) { if (b&(1LL<> n >> p; lint cnt = 0; lint power = 1; for (lint i = 1; i <= n; i++) { lint x = i; power*=i; power%=MOD; while (x%p == 0) cnt++, x/=p; } cnt %= MOD; lint num = modpow(power, power, MOD); cout << (num*cnt)%MOD << endl; }