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>

#define mod 1000000007
struct yak{
		long long a;
		int c;
};

long long ka(long long x,long long a){
//		printf("%lld\n",a);
		if(a==1)return x;
		if(a%2==0){
				long long b;
				b=ka(x,a/2);
				return (b*b)%mod;
		}
		return (x*ka(x,a-1))%mod;
}

long long div(long long x,long long y){
		return (x*ka(y,mod-2))%mod;
}

long long ncm(long long n,long long m){
		long long r=1,i,rr=1,rrr=1;
		for(i=2;i<=n;i++)r=(r*i)%mod;
		for(i=2;i<=m;i++)rr=(i*rr)%mod;
		for(i=2;i<=n-m;i++)rrr=(rrr*i)%mod;
		return (div(div(r,rr),rrr))%mod;
}
int main(){
		int n,i,c=0;
		long long m,j,ans=1;
		struct yak yaku[1000];
		scanf("%d%lld",&n,&m);
		if(n==1||m==1){
				puts("1");
				return 0;
		}
		for(i=0;i<1000;i++)yaku[i].c=0;
		for(j=2;j*j<=m;j++){
				if(m%j==0){
						int f=0;
						for(i=0;i<c;i++){
								if(yaku[i].a==j){
										yaku[i].c+=1;
										f=1;
										break;
								}
						}
						if(f==0){
								yaku[c].a=j;
								yaku[c].c=1;
								c++;
						}
						m/=j;
						j=1;
				}
										//printf("%lld\n",yaku[0].c);
		}
		if(c==0){
				printf("%d\n",n);
				return 0;
		}
		if(m!=1){
				int f=0;
				for(i=0;i<c;i++){
						if(yaku[i].a==m){
								yaku[i].c++;
								f=1;
								break;
						}
				}
				if(f==0){
						yaku[c].a=m;
						yaku[c].c=1;
						c++;
				}
		}
		for(i=0;i<c;i++){
//				printf("%lld\n",ncm(n+yaku[i].c-1,n-1));
				ans=(ans*ncm(n+yaku[i].c-1,n-1))%mod;
		}
		printf("%lld\n",ans%mod);
		return 0;
}