#include <iostream>
#include <string>
using namespace std;
int main()
{
int a, b=2, c=0;
cin >> a;
while (a > 1)
{
while (a%b==0)
{
a = a / b;
c = c + 1;
}
if (c != 0)
{
if (c == 1)
{
cout << b;
}
else
{
cout << b << "^" << c;
}
if (a != 1)
{
cout << " " << "*" << " ";
}
}
b = b + 1;
c = 0;
}
}