#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void qwq(string &s,string t){
if(t.size()<s.size()||s=="")s=t;
}
ll n;
string s;
unordered_map<ll,string>mp;
string f(int a,int p,int q,int b){
string t;
if(a!=1){
if(mp[a]=="")t+=to_string(a)+"*";
else t+=mp[a]+"*";
}
t+=to_string(p),t+="^",t+=to_string(q);
if(b!=0){
if(mp[b]=="")t+="+",t+=to_string(b);
else t+="+",t+=mp[b];
}
return t;
}
void solve(){
cin>>n;s=to_string(n);
for(ll i=sqrt(n);i>=2;i--){
ll t=i;int pw=1;
while(t<=n){
if(mp[t]=="")qwq(mp[t],to_string(t));
qwq(mp[t],to_string(i)+"^"+to_string(pw));
t*=i,pw++;
}
}
for(ll i=2;i*i<=n;i++){
ll t=i;int pw=1;
while(t<=n){
qwq(s,f(n/t,i,pw,n%t));
t*=i,pw++;
}
}
cout<<s;
}
int main(){
// freopen("a.in","r",stdin);
// freopen("a.out.txt","w",stdout);
// ios::sync_with_stdio(0),cin.tie(0);
solve();
return 0;
}//O(n^2)