x = int(input())
y = 2
z = 1
h = x
g = x
if x == 1 :
print(x)
elif x != 1 :
for i in range(x) :
if x % y == 0 and x != 1 :
print (y,end=" ")
if x == 0 :
break
elif g % (y**2) == 0 :
for j in range(x) :
h = h //(y)
z = z + 1
if ( h / y ) % 1 != 0 :
z = z - 1
break
x = x // (y**z)
print ("^",z,end=" ")
z = 1
if x > 1 :
print ("*",end=" ")
elif x % (y**2) != 0 and x != 1 and x != 0:
x = x // y
if x % (y**2) != 0 and x != 1 and x != 0:
print ("*",end=' ')
elif x % y != 0 :
y = y + 1
elif x == 1 :
break
x = int(input())
y = 2
z = 1
h = x
g = x
if x == 1 :
print(x)
elif x != 1 :
for i in range(x) :
if x % y == 0 and x != 1 :
print (y,end=" ")
if x == 0 :
break
elif g % (y**2) == 0 :
for j in range(x) :
h = h //(y)
z = z + 1
if ( h / y ) % 1 != 0 :
z = z - 1
break
x = x // (y**z)
print ("^",z,end=" ")
z = 1
if x > 1 :
print ("*",end=" ")
elif x % (y**2) != 0 and x != 1 and x != 0:
x = x // y
if x % (y**2) != 0 and x != 1 and x != 0:
print ("*",end=' ')
elif x % y != 0 :
y = y + 1
elif x == 1 :
break
killed
l超超時的意思