x=int(input())
count=0
for i in range (2,x+1):
while x%i==0:
x=x/i
count+=1
else:
if count==1:
print(i,end=' ')
count=0
if x!=1:
print('*',end=' ')
continue
elif count!=1 and count!=0:
print(str(i)+'^'+str(count),end=' ')
count=0
if x!=1:
print('*',end=' ')
count=0
continue
continue