D - Factorization Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 400400

問題文

正整数 N,MN, M が与えられます。

a1×a2×...×aN=Ma_1 \times a_2 \times ... \times a_N = M となる正整数からなる長さ NN の数列 aa が何通りあるかを 109+710^9+7 で割った余りを求めてください。

ただし、数列 aa'aa'' が異なるとは、ある ii が存在して aiaia_i' \neq a_i'' であることをいいます。

制約

  • 入力はすべて整数である
  • 1N1051 \leq N \leq 10^5
  • 1M1091 \leq M \leq 10^9

入力

入力は以下の形式で標準入力から与えられる。

NN MM

出力

条件を満たす正整数からなる数列が何通りあるかを 109+710^9 + 7 で割った余りを出力せよ。


入力例 1Copy

Copy
2 6

出力例 1Copy

Copy
4

{a1,a2}={1,6},{2,3},{3,2},{6,1}\{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\}, \{6, 1\}44 通りの数列が条件を満たします。


入力例 2Copy

Copy
3 12

出力例 2Copy

Copy
18

入力例 3Copy

Copy
100000 1000000000

出力例 3Copy

Copy
957870001

Score : 400400 points

Problem Statement

You are given positive integers NN and MM.

How many sequences aa of length NN consisting of positive integers satisfy a1×a2×...×aN=Ma_1 \times a_2 \times ... \times a_N = M? Find the count modulo 109+710^9+7.

Here, two sequences aa' and aa'' are considered different when there exists some ii such that aiaia_i' \neq a_i''.

Constraints

  • All values in input are integers.
  • 1N1051 \leq N \leq 10^5
  • 1M1091 \leq M \leq 10^9

Input

Input is given from Standard Input in the following format:

NN MM

Output

Print the number of the sequences consisting of positive integers that satisfy the condition, modulo 109+710^9 + 7.


Sample Input 1Copy

Copy
2 6

Sample Output 1Copy

Copy
4

Four sequences satisfy the condition: {a1,a2}={1,6},{2,3},{3,2}\{a_1, a_2\} = \{1, 6\}, \{2, 3\}, \{3, 2\} and {6,1}\{6, 1\}.


Sample Input 2Copy

Copy
3 12

Sample Output 2Copy

Copy
18

Sample Input 3Copy

Copy
100000 1000000000

Sample Output 3Copy

Copy
957870001


2025-06-28 (Sat)
11:26:49 +00:00