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)

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main()
{
    input! {
        n: u64,
        m: u64,
    }

    let d = 10u64.pow(9)+7;
    let mut v = vec![];
    factorization(m, &mut v);

    let mut ans = 1;
    for b in v.iter() {
        ans = (ans * comb(*b, n, d)) % d;
    }

    println!("{}", ans);
}

fn factorization(t: u64, v: &mut Vec<u64>) {
    let mut i = 2;
    let mut m = t;

    while i * i <= m {
        let mut count = 0;
        while m % i == 0 {
            count = count + 1;
            m = m / i;
        }
        v.push(count);
        i = i + 1;
    }

    if m != 1 {
        v.push(1);
    }
}

fn comb(b: u64, n: u64, d: u64) -> u64{
    let num: u64 = (1..b+n).rev().take(b as usize).fold(1, |n, i| n*i%d);
    let den: u64 = (1..b+1).fold(1, |n, i| n*i%d);

    num*modinv(den, d) % d
}

fn modinv (a: u64, d: u64) -> u64 {
    modpow(a, d - 2, d)
}

fn modpow(x: u64, y: u64, d: u64) -> u64 {
    let mut res = 1;
    let mut a = x;
    let mut n = y;
    while n > 0 {
        if n & 1 != 0 {
            res = res * a % d;
        }
        a = a * a % d;
        n = n >> 1;
    }
    res
}