#include<bits/stdc++.h>
using namespace std;
int main(){
int n,f = 0;
cin >> n;
map<int,int>mp;
for(int i=2;i<=n;i++){
while(n%i0){
if(!f) f = i;
mp[i]++;
n /= i;
}
}
for(auto i:mp) {
if(i.first != f) cout << "*";
if(i.second1) cout << i.first;
else cout << i.first << "^" << i.second;
}
}