#include<iostream>
using namespace std;
int main(){
int n , k;
while(cin >> n){
if(n == 1){
cout << "1";
}
if(n < 1){
n = 1;
}
else if(n > 1000000){
n = 1000000;
}
for(int i = 2 ; i < 2000 ; i++){
k = 0;
while(n % i == 0){
n = n/i;
k++;
}
if(n != 1){
if(k == 1){
cout << i << " * ";
}
else if(k > 1){
cout << i << "^" << k << " * ";
}
}else{
if(k == 1){
cout << i;
}
else if(k > 1){
cout << i << "^" << k;
}
}
}
cout << endl;
}
return 0;
}