#include<iostream>
using namespace std;
int main(){
int n;
while(cin >> n){
for(int i=2;i<=n;i++){
int time=0;
while(n % i == 0){ //判斷次方
n = n / i;
time++;
}
if(time > 1 && n != 1){
cout << i << "^" << time << " * ";
}
if(time > 1 && n == 1){ //最後一個沒有*的
cout << i << "^" << time;
}
if(time == 1 && n != 1){
cout << i << " * ";
}
if(time == 1 && n == 1){ //最後一個沒有*的
cout << i;
}
}
cout << endl;
}
}