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