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

#SP0000028. Phân tích thừa số có dấu (Prime Factors)

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ố có dấu (Prime Factors)

Prime Factors

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given an integer gg other than −1-1, 00, or 11, output its prime factorization. Prime factors must appear in nondecreasing order, including repetitions.

If g<0g<0, start with the factor −1-1 and then list the prime factors of ∣g∣|g|. If g>0g>0, list only its prime factors.

Input

One line containing the integer gg.

Output

Print one line formatted as g = f1 x f2 x ... x fk; the multiplication symbol is lowercase x with one space on each side. For negative gg, the first factor is -1.

Subtasks

  • Subtask 1 (20 points): −1000≤g≤1000-1000\le g\le1000; g∉{−1,0,1}g\notin\{-1,0,1\}.
  • Subtask 2 (30 points): −106≤g≤106-10^6\le g\le10^6; g∉{−1,0,1}g\notin\{-1,0,1\}.
  • Subtask 3 (50 points): −231<g<231-2^{31}<g<2^{31}; g∉{−1,0,1}g\notin\{-1,0,1\}.

Examples

Input

-190

Output

-190 = -1 x 2 x 5 x 19

Explanation

Since 190=2⋅95=2⋅5⋅19190=2\cdot95=2\cdot5\cdot19 and 2,5,192,5,19 are prime, the signed factorization is −190=(−1)⋅2⋅5⋅19-190=(-1)\cdot2\cdot5\cdot19.

Input

196

Output

196 = 2 x 2 x 7 x 7

Explanation

We have 196=142=(2⋅7)2=2⋅2⋅7⋅7196=14^2=(2\cdot7)^2=2\cdot2\cdot7\cdot7, printed in nondecreasing order.