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>
#include<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

#define MOD 1000000007

//昇順
int asc(const void* a, const void* b){
    return *(int*)a-*(int*)b;
}

//割り算
long divi(long U,long D){
    if(U==D) return 1;

    if(U%D==0) return (U/D)%MOD;
    else return divi(U+MOD,D);
}

//nCmを求める
long combination(int n, int m){
    long U=1;
    long D=1;

    for(int i=n;i>(n-m);i--) U=(U*i)%MOD;
    for(int i=1;i<=m;i++) D=(D*i)%MOD;

    long ans=divi(U,D);
    return ans;
}


int main(void){
    int N,M;
    scanf("%d%d",&N,&M);

    int prime_factor[100000];
    for(int i=0;i<100000;i++) prime_factor[i]=0;

    //素因数分解
    int p_factor_num=0;
    for(int i=2;i*i<=M;i++){
        if(M%i==0){
            while(M%i==0){
                prime_factor[p_factor_num]++;
                M=M/i;
            }
            p_factor_num++;
        }
    }
    if(M>1){
        prime_factor[p_factor_num]++;
        p_factor_num++;
    }

    long long ans=1;
    for(int i=0;i<p_factor_num;i++){
        ans*=combination(prime_factor[i]+N-1,prime_factor[i]);
        ans%=MOD;
    }
    printf("%lld\n",ans);

    return 0;
}