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 Go (1.6) (judge verdict: Wrong Answer)

// 難さんすう すーぱーさんすうと呼ぼう
// Mを素因数分解しといて例えばM=12としてM=(2^2) * (3^1)なるが、それぞれの因数をそれぞれの乗数ぶん振り分ける感じにした組み合わせが答え
// N = 3なら [1, 1, 1]の3つのどれかに振り分ける つまり以下
// 因数2を2つ,因数3を1つ を振り分けて、
//			[2^1, 2^1, 2^0], [3^1, 3^0, 3^0]
// 				-> [1*(2^1 * 3^1)] * [1*(2^1 * 3^0)] * [1*(2^0 * 3^0)] = 6*2*1 = 12
// あるいは
//			[2^2, 2^0, 2^0], [3^0, 3^0, 3^1] ならば
//				-> [1*(2^2 * 3^0)] * [1*(2^0 * 3^0)] * [1*(2^0 * 3^1)] = 4*1*3 = 12
// あるいは
//			[2^1, 2^1, 2^0], [3^0, 3^0, 3^1] ならば
//				-> [1*(2^1 * 3^0)] * [1*(2^1 * 3^0)] * [1*(2^0 * 3^1)] = 2*2*3 = 12
//
// 解説の""計算量はNに依らない""が意味不明だけど、説明してくれないので無視
// すーぱーさんすうの世界ではこれを重複組合せと呼ばうらしい 漢字だね 画数が多い
// n種類のものから重複を許してr個選ぶ場合の数 = nHr = (n+r-1)Cr に帰着できるらしい

// nCr mod Pなので気をつける
package main

import (
	"fmt"
	"math"
)

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	arr := primeFactorization(M)
	ans := 1
	MOD := int(math.Pow10(9)) + 7
	for _, v := range arr {
		ans *= ncrMod(v+N-1, v, MOD)
		if ans < 0 {
			ans += MOD
		}
	}
	fmt.Println(ans % MOD)
}

func primeFactorization(x int) map[int]int {
	ret := make(map[int]int)
	for i := 2; float64(i) <= math.Sqrt(float64(x)); i++ {
		for x%i == 0 {
			x /= i
			if _, ok := ret[i]; ok {
				ret[i] += 1
			} else {
				ret[i] = 1
			}
		}
	}
	if x > 1 {
		ret[x] = 1
	}
	return ret
}

func ncrMod(n, r, mod int) int {
	// 呼び出すたびにテーブルを作るのは愚
	_n := 1000000
	g1 := make([]int, _n+1)
	g1[0], g1[1] = 1, 1
	g2 := make([]int, _n+1)
	g2[0], g2[1] = 1, 1
	inverse := make([]int, _n+1)
	inverse[0], inverse[1] = 0, 1
	for i := 2; i <= _n; i++ {
		g1[i] = (g1[i-1] * i) % mod
		inverse[i] = mod - inverse[mod%i]*(mod/i)%mod
		g2[i] = (g2[i-1] * inverse[i]) % mod
	}

	return g1[n] * (g2[r] * g2[n-r] % mod) % mod
}

func comb(n, m, MOD int) int {
	return factorial(n, n-m+1, MOD) * pow(factorial(m, 2, MOD), MOD-2, MOD) % MOD
}

func pow(x, n, MOD int) int {
	r := 1
	for ; n > 0; n /= 2 {
		if n%2 == 1 {
			r = r * x % MOD
		}
		x = x * x % MOD
	}
	return r
}

func factorial(n, m, MOD int) int {
	r := 1
	for i := m; i <= n; i++ {
		r = r * i % MOD
	}
	return r
}