#include <iostream>
#include <cmath>
using namespace std;
int main()
{
long input;
while(cin >> input){
int i = 2;
int count = 0;
int base = 0;
while ( i <= input ){
if( input%i == 0){
count += 1;
base = i;
input /= i;
}
else{
if(count > 1)
cout << base << "^" << count << " * ";
if(count == 1)
cout << base << " * ";
count = 0;
i++;
}
}
if(count > 1)
cout << base << "^" << count << endl;
if(count == 1)
cout << base << endl;
if ( i == input )
cout << i << endl;
}
return 0;
}