Problem:
Score : 400 points

Problem Statement

You are given positive integers N and M.

How many sequences a of length N consisting of positive integers satisfy a_1 \times a_2 \times ... \times a_N = M? Find the count modulo 10^9+7.

Here, two sequences a' and a'' are considered different when there exists some i such that a_i' \neq a_i''.

Constraints

All values in input are integers.

1 \leq N \leq 10^5

1 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

N M

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.

Sample Input 1

2 6

Sample Output 1

4

Four sequences satisfy the condition: \{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and \{6, 1\}.

Sample Input 2

3 12

Sample Output 2

18

Sample Input 3

100000 1000000000

Sample Output 3

957870001

Solution in C (GCC 5.4.1) (judge verdict: Accepted)

#include <stdio.h>
long long int kaizyou(long long int x,long long int y,long long z){
    //xの階乗（mod y）
    long long int tmp=1;
    for(int i=x;i<=z;i++){
        tmp*=i;
        tmp%=y;
    }
    return tmp;
}

long long int ruizyou(long long int x,long long y,long long int z){
    //xのｙ乗(modz)
    long long int tmp=1;
    long long int s[100]={};
    int memo[100]={};
    s[0]=x;
    for(int i=0;i<100;i++){
        memo[i]=y%2;
        y/=2;
    }
    for(int i=1;i<100;i++){
        s[i]=(x*x)%z;
        x=(x*x)%z;
    }
    for(int i=0;i<100;i++){
        if(memo[i]==1){
            tmp=(tmp*s[i])%z;
        }
    }
    return tmp;
}

long long int combination(long long int x,long long int y,long long int z){
    //xCy(mod z)
    long long int tmp=1;
    tmp=(tmp*kaizyou(y+1,z,x))%z;
    tmp=(tmp*ruizyou(kaizyou(1,z,x-y),z-2,z))%z;
    return tmp;
}


int main(void){
    long long int n,m,sosu[100]={},memo=0,copy_m,max=1,result=1;
    
    scanf("%lld%lld",&n,&m);
    
    copy_m=m;
    
    for(int i=2;i<32000;i++){
        if(m%i==0)memo++;
        next:
        if(m%i==0){
            m/=i;
            sosu[memo]++;
            max*=i;
            goto next;
        }
    }
   
    if(copy_m/max>=32000){
        sosu[memo+1]++;
    }
    
    for(int i=1;i<=99;i++){
        result*=combination(n+sosu[i]-1,n-1,1000000007);
        result%=1000000007;
    }
    printf("%lld",result);
    
    
}