#include #include #include #include #include #include #include #include #include #include #include #include typedef long long ll; using namespace std; #define mod 1000000007 #define INF 1000000000 #define LLINF 2000000000000000000LL #define PI 3.1415926536 #define SIZE 1000000 ll gygen[SIZE]; ll factorial(int n,int M){ ll ret = 1; if(n<=1) return 1; for(int i=1;i<=n;i++){ ret = (ret*i)%M; } return ret; } ll power(int k,int n,int M){ if(n==0) return 1; if(n==1) return (ll)k; ll ret = power(k,n/2,M); ret=(ret*ret)%M; if(n%2==1) ret=(ret*k)%M; return ret; } ll get_gygen(int k){ int ret; if(k < SIZE) return gygen[k]; for(int j=2;j*j<=k;j++){ if(k%j==0){ return (get_gygen(j)*get_gygen(k/j))%mod; } } return power(k,mod-2,mod); } //nCm (mod p) p is prime number int C(int n,int m,int M){ if(n