PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000174. Số nguyên tố và phép nhân (Primes and Multiplication)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số nguyên tố và phép nhân (Primes and Multiplication)

Primes and Multiplication

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

For a positive integer xx, let P(x)P(x) be the set of its distinct prime divisors. For a prime pp, define g(y,p)g(y,p) as the largest power of pp that divides yy; it equals 11 if pp does not divide yy.

Define

f(x,y)=∏p∈P(x)g(y,p).f(x,y)=\prod_{p\in P(x)}g(y,p).

For example, P(30)={2,3,5}P(30)=\{2,3,5\} and f(30,70)=2⋅1⋅5=10f(30,70)=2\cdot1\cdot5=10.

Given xx and nn, calculate

F=∏y=1nf(x,y),F=\prod_{y=1}^{n}f(x,y),

and print FF modulo 109+710^9+7.

Input

One line containing two integers xx and nn.

Output

Print F mod (109+7)F\bmod(10^9+7).

Subtasks

  • Subtask 1 (20 points): 2≤x≤104,1≤n≤1052 \le x \le 10^4,\quad 1 \le n \le 10^5.
  • Subtask 2 (30 points): 2≤x≤106,1≤n≤10102 \le x \le 10^6,\quad 1 \le n \le 10^{10}.
  • Subtask 3 (50 points): 2≤x≤109,1≤n≤10182 \le x \le 10^9,\quad 1 \le n \le 10^{18}.

Examples

Example 1

Input

10 2

Output

2

Explanation

P(10)={2,5}P(10)=\{2,5\}. Here f(10,1)=1f(10,1)=1 and f(10,2)=2f(10,2)=2, so the product is 22.

Example 2

Input

20190929 1605

Output

363165664

Explanation

20190929=11⋅647⋅283720190929=11\cdot647\cdot2837. Their exponents in 1605!1605! are 159159, 22 and 00. Thus the result is congruent to 11159⋅6472⋅2837011^{159}\cdot647^2\cdot2837^0, whose remainder modulo 109+710^9+7 is 363165664363165664.