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

#SP0000271. Phân tích thừa số nguyên tố của số lớn (Factorizing Large Integers)

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 số lớn (Factorizing Large Integers)

Factorizing Large Integers

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive integer NN, express it as a product of prime factors. Write each distinct prime factor once, with an exponent equal to its multiplicity, and list the factors in ascending order.

Input

One line contains the positive integer NN.

Output

Print one line in the form N = p1^e1 * p2^e2 * ..., replacing N with the input value. Prime factors are in ascending order, separated by *. Omit the exponent when it equals 11.

Subtasks

  • Subtask 1 (20 points): 2≤N≤10000002\le N\le 1000000.
  • Subtask 2 (30 points): 2≤N≤10000000000002\le N\le 1000000000000.
  • Subtask 3 (50 points): 2≤N≤100000000000000002\le N\le 10000000000000000.

Examples

Example 1

Input

60

Output

60 = 2^2 * 3 * 5

Explanation

Starting from 6060, divide successively by prime factors: 60÷2=3060\div 2=30; 30÷2=1530\div 2=15; 15÷3=515\div 3=5; 5÷5=15\div 5=1. Combine equal factors into powers, omit exponent 11, write 6060 before =, and separate groups with *. The resulting output is 60 = 2^2 * 3 * 5.

Example 2

Input

36

Output

36 = 2^2 * 3^2

Explanation

Starting from 3636, divide successively by prime factors: 36÷2=1836\div 2=18; 18÷2=918\div 2=9; 9÷3=39\div 3=3; 3÷3=13\div 3=1. Combine equal factors into powers, omit exponent 11, write 3636 before =, and separate groups with *. The resulting output is 36 = 2^2 * 3^2.

Example 3

Input

10007

Output

10007 = 10007

Explanation

Starting from 1000710007, divide successively by prime factors: 10007÷10007=110007\div 10007=1. Combine equal factors into powers, omit exponent 11, write 1000710007 before =, and separate groups with *. The resulting output is 10007 = 10007.