from sys import stdin def factoring(num): prime_factors = [] n=2 while n<=num: if num%n !=0: n+=1 else: prime_factors.append(n) num/=n fact_dict={i:prime_factors.count(i) for i in prime_factors} factor_string ="" for key in sorted(fact_dict): if fact_dict[key] == 1: factor_string+=str(key)+" * " else: factor_string+=str(key)+"^"+str(fact_dict[key])+" * " return factor_string[0:len(factor_string)-2] for line in stdin: print(factoring(int(line)))