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: Wrong Answer)

use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: u64 = read();
    let m: u64 = read();

    let ps = m.prime_factorization();
    let mut ans = 1;

    for &(_, c) in ps.iter() {
        ans = (ans * mod_comb(c + n - 1, n - 1)) % MOD;
    }

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

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

// need IntegerSqrt
trait PrimeFactorization: Sized {
    fn prime_factorization(&self) -> Vec<(Self, Self)>;
}

impl PrimeFactorization for u64 {
    fn prime_factorization(&self) -> Vec<(Self, Self)> {
        let mut n = *self;
        let mut result = vec![];
        for p in 2..self.isqrt() + 2 {
            let mut count = 0;
            while n % p == 0 {
                n /= p;
                count += 1;
            }
            if count != 0 {
                result.push((p, count));
            }
        }

        if result.len() == 0 {
            result.push((*self, 1));
        }

        result
    }
}

// https://en.wikipedia.org/wiki/integer_square_root
trait IntegerSqrt {
    fn isqrt(&self) -> Self;
}

impl IntegerSqrt for u64 {
    fn isqrt(&self) -> Self {
        if *self < 2 {
            *self
        } else {
            let s = (*self >> 2).isqrt() << 1;
            let l = s + 1;
            if l * l > *self {
                s
            } else {
                l
            }
        }
    }
}

// M が素数のときの mod M の割り算は掛け算に変換できる
// p が素数のとき a^(p-1) ≡ 1 (mod p) <-> a^(p-2) ≡ a^(-1) (mod p)
// a^(-1) 掛ける(a で割る)代わりに a^(p-2) 掛ける
// 分子 numerator
// 分母 denominator
// nCr

const MOD: u64 = 1_000_000_007;

fn mod_comb(n: u64, r: u64) -> u64 {
    let num = (2..r + 1).fold(1, |a, i| a * i % MOD);
    let den = (n - r + 1..n + 1).fold(1, |a, i| a * i % MOD);
    den * mod_pow(num, MOD - 2) % MOD
}

// a^b (mod p)の計算
// b^e (mod m)
// e & 1 == 0 equal e % 2 == 0

fn mod_pow(b: u64, e: u64) -> u64 {
    if e == 0 {
        1
    } else if e & 1 == 0 {
        let d = mod_pow(b, e / 2);
        (d * d) % MOD
    } else {
        (b * mod_pow(b, e - 1)) % MOD
    }
}