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 Rust (1.15.1) (judge verdict: Accepted)

const MOD: usize = 1_000_000_007;

fn solve(src: &str) -> String {
    let mut sw = src.split_whitespace();
    let n: usize = sw.next().unwrap().parse().ok().unwrap();
    let m: usize = sw.next().unwrap().parse().ok().unwrap();

    let mut ftl = vec![1];
    for i in 1..n+100 {
        let pre = ftl[i-1];
        ftl.push(i * pre % MOD);
    }
    let pat = |n, r| ftl[n+r-1] * inv(ftl[r]) % MOD * inv(ftl[n-1]) % MOD;
    
    let fct = factorize(m);
    let mut ans = 1;
    for &(_, e) in &fct {
        ans *= pat(n, e);
        ans %= MOD;
    }
    format!("{}\n", ans)
}
#[test]
fn test_solve() {
   assert_eq!(solve("2 6\n"), "4\n");
   assert_eq!(solve("3 12\n"), "18\n");
   assert_eq!(solve("100000 1000000000\n"), "957870001\n");
}
fn inv(n: usize) -> usize {
    let mut ret = 1;
    let mut sqt = vec![n; 31];
    for i in 1..31 {
        sqt[i] = sqt[i-1] * sqt[i-1] % MOD;
    }
    let exp = MOD-2;
    for i in 0..31 {
        if 1<<i & exp != 0 {
            ret *= sqt[i];
            ret %= MOD;
        }
    }
    ret
}
fn factorize(n: usize) -> Vec<(usize, usize)> {
    let mut ret = Vec::new();
    let mut n = n;
    let nsr = (n as f64).sqrt() as usize;
    for &p in &primes(nsr+1) {
        let mut c = 0;
        while n % p == 0 {
            c += 1;
            n /= p;
        }
        if c > 0 {
            ret.push((p, c));
        }
    }
    if n > 1 {
        ret.push((n, 1));
    }
    ret
}
fn primes(n: usize) -> Vec<usize> {
    let mut ret = Vec::new();
    let mut ipm = vec![true; n+1];
    let nsr = (n as f64).sqrt() as usize;
    for p in 2..nsr+1 {
        if ipm[p] {
            let mut mpp = 2*p;
            while mpp <= n {
                ipm[mpp] = false;
                mpp += p;
            }
        }
    }
    for p in 2..n+1 {
        if ipm[p] {
            ret.push(p);
        }
    }
    ret
}
fn main() {
    use std::io::{Read, Write};
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}