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

#GL0000178. Phân tích thừa số nguyên tố của giai thừa (Intelligent Factorial Factorization)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Phân tích thừa số nguyên tố của giai thừa (Intelligent Factorial Factorization)

Intelligent Factorial Factorization

Source: LightOJ

Version: Phuoc Hung OJ Extended

Problem Statement

For an integer NN, the factorial N!N! equals 1⋅2⋯N1\cdot2\cdots N. Although it grows rapidly, it has a unique prime factorization

N!=p1a1p2a2⋯pkak,N!=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k},

where p1<p2<⋯<pkp_1<p_2<\cdots<p_k are all primes appearing in N!N!, and the exponents aia_i are positive.

Print the prime factorization in the prescribed textual format, rather than the factorial itself.

Input

One line containing the integer NN.

Output

Print one line starting with N = , replacing N with the input value. Then print groups p (a) in increasing order of pp, separated by *. Each group gives a prime factor pp and its exponent aa in N!N!. Do not print a Case prefix.

Subtasks

  • Subtask 1 (20 points): 2≤N≤202 \le N \le 20.
  • Subtask 2 (30 points): 2≤N≤602 \le N \le 60.
  • Subtask 3 (50 points): 2≤N≤1002 \le N \le 100.

Examples

Example 1

Input

6

Output

6 = 2 (4) * 3 (2) * 5 (1)

Explanation

6!=720=24⋅32⋅56!=720=2^4\cdot3^2\cdot5. The ascending primes are 2,3,52,3,5 with exponents 4,2,14,2,1; spaces and separators follow the sample.

Example 2

Input

2

Output

2 = 2 (1)

Explanation

2!=22!=2 has a single prime factor 22 with exponent 11.