#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define local freopen("in","r",stdin);\
			freopen("out","w",stdout);
#define DBG(x) cout<<(#x)<<"="<<x<<endl
#define DBG2(x,y) cout<<(#x)<<"="<<x<<"\t"<<(#y)<<"="<<y<<endl
#define DBG3(x,y,z) cout<<(#x)<<"="<<x<<"\t"<<(#y)<<"="<<y<<"\t"<<(#z)<<"="<<z<<endl
ll n ;
string best;

int get_length(ll n )
{
	int count = 0;
	do{
		count++;
		n/=10;
	}while(n);
	return count;
}
string lltoString(ll n)
{
	string str;
	while(n)
	{
		char c= n-n/10*10+'0';
		str =str+c;
		n/=10;
	}
	reverse(str.begin(),str.end());
	return str;
}
ll pow(ll a,ll b)
{
	ll v = 1 ;
	while(b)
	{
		if(b&1)
		{
			v=v*a;
		}
		a=a*a;
		b/=2;
	}
	return v;
}
int main()
{

	cin>>n;
	best = lltoString(n);

	// a^b *c+d
	//
	for(ll b = 2; pow(2, b) <= 1e18; b++)
		 for(ll a = 2;pow(a,b)<=1e18&& pow(a,b)<=n;a++)
		 {

		 	ll c = n/pow(a,b);
		 	ll d = n-c*pow(a,b);
		 // 	DBG2(c,d);
 	#if 1
		 	string cacdidate = lltoString(a)+"^"+lltoString(b);
		 	if(c>1)
		 		cacdidate+="*"+lltoString(c);
		 	if(d>0)
		 		cacdidate+="+"+lltoString(d);

		 	if(cacdidate.size()<best.size())
		 		best = cacdidate;
	#endif
		 }
//	DBG(best);

	// a^b + c^d*e + f
	//
	for(ll b =2;pow(2,b)<=1e18;b++)
		for(ll a =2 ;a<=1000&&pow(a,b)<=min((ll)1e18,n);a++)
		{
			ll p = pow(a,b);
			for(ll d =2 ; p+pow(2,d)<=n;d++)
				for(ll c =2;c< (a>=100?10:100) && p+pow(c,d)<=min((ll)1e18,n) ; c++ )
				{
					ll p2 = pow(c,d);
					ll e= (n-p)/p2;
					ll f= n-p-p2*e;
					int length = get_length(a)+get_length(b)+get_length(c)+get_length(d)+3;
					if(length >= best.size()) continue;
					if(e>1)
						length+=get_length(e)+1;
					if(f>0)
					 	length+=get_length(f)+1;
					 if(length<best.size())
					 {
					 	string cacdidate = lltoString(a)+"^"+lltoString(b)+"+"+lltoString(c)+"^"+lltoString(d);
						if(e>1)
							cacdidate+="*"+lltoString(e);
						if(f>0)
							cacdidate+="+"+lltoString(f);
						if(cacdidate.size()<best.size())
							best = cacdidate;
					 }
				}
		}

	//a^b*c^d*e +f

	for(ll b =2;pow(2,b)<=1e18;b++)
		for(ll a =2 ;a<=1000&&pow(a,b)<=min((ll)1e18,n);a++)
		{
			ll  p= pow(a,b);
			for(ll d =2 ; p*pow(2,d)<=n;d++)
				for(ll c =2;c< (a>=100?10:100) && p*pow(c,d)<=min((ll)1e18,n) ; c++ )
				{
					ll pp = p*pow(c,d);
					ll e = n/pp;
					ll f = n-pp*e;
					int length = get_length(a)+get_length(b)+get_length(c)+get_length(d)+3;

					if(length>best.size()) continue;
					if(e>1) length+=get_length(e)+1;
					if(f>0) length+=get_length(f)+1;
					if(length<best.size())
					{
						string cacdidate=  lltoString(a)+"^"+lltoString(b)+"*"+lltoString(c)+"^"+lltoString(d);
						if(e>1)
							cacdidate+="*"+lltoString(e);
						if(f>0)
							cacdidate+="+"+lltoString(f);
						if(cacdidate.size()<best.size())
							best = cacdidate;
					}

				}
		}
	cout<<best<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n;
	cin>>n;
	map<ll,string>ss;
	for(ll i=2;i<=n;i++){
		for(ll j=i*i,k=2;j<=n;j*=i,k++){
			string tmp=to_string(i)+'^'+to_string(k);
			if(!ss.count(j)) ss[j]=to_string(j);
			if(tmp.size()<ss[j].size()) ss[j]=tmp;
		}
	}
	string ans=to_string(n);
	for(auto i:ss){
		string t="";
		ll a=n/i.first;
		ll b=n%i.first;
		if(a>1){
			if(ss.count(a)){
				t=ss[a];
			}else t=to_string(a);
			t+="*";
		}
		t+=i.second;
		if(b){
			t+="+";
			if(ss.count(b)){
				t+=ss[b];
			}else t+=to_string(b);
		}
		if(t.size()<ans.size()) ans=t;
	}
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,string>ss;
int main(){
	ll n;
	cin>>n;
	for(ll i=2;i*i<=n;i++){
		for(ll j=i*i,k=2;j<=n;j*=i,k++){
			string tmp=to_string(i)+'^'+to_string(k);
			if(!ss.count(j)) ss[j]=to_string(j);
			if(tmp.size()<ss[j].size()) ss[j]=tmp;
		}
	}
	string ans=to_string(n);
	for(auto i:ss){
		string t="";
		ll a=n/i.first;
		ll b=n%i.first;
		if(a>1){
			if(ss.count(a)){
				t=ss[a];
			}else t=to_string(a);
			t+="*";
		}
		t+=i.second;
		if(b){
			t+="+";
			if(ss.count(b)){
				t+=ss[b];
			}else t+=to_string(b);
		}
		if(t.size()<ans.size()) ans=t;
	}
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    val() : val(0, 0, 0) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool operator<(const val& a, const ll b) {
    return a.v < b;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    auto vend = unique(vals.begin(), vals.end(), pred);
    vals.resize(vend - vals.begin());

    string best = to_string(n);

    if (n < 10) {
        cout << best << endl;
        return 0;
    }

    // Try a^b+c^d+e
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    // Try m*a^b+c^d
    for (auto ex : vals) {
        for (ll mul = 2; mul < 10; mul++) {
            ll needed = n - mul*ex.v;
            auto it = lower_bound(vals.begin(), vals.end(), needed);
            if (it != vals.end() && it->v == needed) {
                ll len = 2 + ex.l + 1 + it->l;
                if (len < best.size()) {
                    best = to_string(mul) + "*" + ex.str() + "+" + it->str();
                }
            }
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    val() : val(0, 0, 0) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool operator<(const val& a, const ll b) {
    return a.v < b;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    auto vend = unique(vals.begin(), vals.end(), pred);
    vals.resize(vend - vals.begin());

    string best = to_string(n);

    if (n < 10) {
        cout << best << endl;
        return 0;
    }

    // Try a^b+c^d+e
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    // Try m*a^b+c^d
    for (auto ex : vals) {
        for (ll mul = 2; mul < 10; mul++) {
            ll needed = n - mul*ex.v;
            auto it = lower_bound(vals.begin(), vals.end(), needed);
            if (it != vals.end() && it->v == needed) {
                ll len = 2 + ex.l + 1 + it->l;
                if (len < best.size()) {
                    best = to_string(mul) + "*" + ex.str() + "+" + it->str();
                }
            }
        }
    }

    // a^b*c^d+e
    for (int a = 2; a < 10; a++) {
        for (int b = 2; b < 10; b++) {
            for (int c = 2; c < 10; c++) {
                for (int d = 2; d < 10; d++) {
                    ll val = pow(a, b) * pow(c, d);
                    if (val > n) continue;
                    ll len = 7;
                    if (n != val)
                        len += 1 + length(n - val);
                    if (len < best.size()) {
                        best = to_string(a) + "^" + to_string(b) + "*" + to_string(c) + "^" + to_string(d);
                        if (n != val)
                            best += string("+") + to_string(n - val);
                    }
                }
            }
        }
    }

    // a^b*c^d*e
    for (int a = 2; a < 10; a++) {
        for (int b = 2; b < 10; b++) {
            for (int c = 2; c < 10; c++) {
                for (int d = 2; d < 10; d++) {
                    ll ex = pow(a, b) * pow(c, d);
                    ll mul = n / ex;
                    ll val = ex * mul;
                    if (val != n) continue;
                    if (mul >= 10) continue;
                    if (9 < best.size()) {
                        best = to_string(mul) + "*" + to_string(a) + "^" + to_string(b) + "*" + to_string(c) + "^" + to_string(d);
                    }
                }
            }
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    val() : val(0, 0, 0) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool operator<(const val& a, const ll b) {
    return a.v < b;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    auto vend = unique(vals.begin(), vals.end(), pred);
    vals.resize(vend - vals.begin());

    string best = to_string(n);

    if (n < 10) {
        cout << best << endl;
        return 0;
    }

    // Try a^b+c^d+e
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    // Try m*a^b+c^d
    for (auto ex : vals) {
        for (ll mul = 2; mul < 10; mul++) {
            ll needed = n - mul*ex.v;
            auto it = lower_bound(vals.begin(), vals.end(), needed);
            if (it != vals.end() && it->v == needed) {
                ll len = 2 + ex.l + 1 + it->l;
                if (len < best.size()) {
                    best = to_string(mul) + "*" + ex.str() + "+" + it->str();
                }
            }
        }
    }

    // a^b*c^d+e
    for (int a = 2; a < 10; a++) {
        for (int b = 2; b < 10; b++) {
            for (int c = 2; c < 10; c++) {
                for (int d = 2; d < 10; d++) {
                    ll val = pow(a, b) * pow(c, d);
                    if (val > n) continue;
                    ll len = 7;
                    if (n != val)
                        len += 1 + length(n - val);
                    if (len < best.size()) {
                        best = to_string(a) + "^" + to_string(b) + "*" + to_string(c) + "^" + to_string(d);
                        if (n != val)
                            best += string("+") + to_string(n - val);
                    }
                }
            }
        }
    }

    // a^b*c^d*e
    for (int a = 2; a < 10; a++) {
        for (int b = 2; b < 10; b++) {
            for (int c = 2; c < 10; c++) {
                for (int d = 2; d < 10; d++) {
                    ll ex = pow(a, b) * pow(c, d);
                    ll mul = n / ex;
                    ll val = ex * mul;
                    if (val != n) continue;
                    if (9 < best.size()) {
                        best = to_string(mul) + "*" + to_string(a) + "^" + to_string(b) + "*" + to_string(c) + "^" + to_string(d);
                    }
                }
            }
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool operator<(const val& a, const ll b) {
    return a.v < b;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    unique(vals.begin(), vals.end(), pred);

    string best = to_string(n);

    if (n < 10) {
        cout << best << endl;
        return 0;
    }

    // Try a^b+c^d+e
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    // Try m*a^b+c^d
    for (auto ex : vals) {
        for (ll mul = 2; mul < 10; mul++) {
            ll needed = n - mul*ex.v;
            auto it = lower_bound(vals.begin(), vals.end(), needed);
            if (it != vals.end() && it->v == needed) {
                ll len = 2 + ex.l + 1 + it->l;
                if (len < best.size()) {
                    best = to_string(mul) + "*" + ex.str() + "+" + it->str();
                }
            }
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    unique(vals.begin(), vals.end(), pred);

    string best = to_string(n);

    // Try a^b+c^d
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll pow(ll b, ll e) {
    if (e == 0) return 1;
    if (e == 1) return b;
    if (e % 2 == 0) {
        ll p = pow(b, e/2);
        return p*p;
    }
    return b*pow(b, e-1);
}

//unordered_map<ll, string> mem;

string construct(ll n) {
    if (n == 0) return "";
    //if (mem.count(n)) return mem[n];
    string best = to_string(n);
    cout<<n<<endl;

    // Try powers
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            ll ex = pow(base, exponent);
            //for (ll mul = 1; mul <= base && mul*ex <= n; mul++) {
                ll mul = n/ex;
                ll val = mul*ex;

                string test = "";
                if (mul > 1) test += to_string(mul) + "*";
                test += to_string(base) + "^" + to_string(exponent);

                if (val != n) {
                    //cout<<"R"<<val<<" "<<n<<endl;
                    test += "+" + construct(n-val);
                }
                if (test.size() < best.size())
                    best = test;
            //}
        }
    }

    //return mem[n] = best;
    return best;
}

ll length(ll n) {
    if (n < 10) return 1;
    if (n < 100) return 2;
    if (n < 1000) return 3;
    if (n < 10000) return 4;
    if (n < 100000) return 5;
    if (n < 1000000) return 6;
    if (n < 10000000) return 7;
    if (n < 100000000) return 8;
    if (n < 1000000000) return 9;
    if (n < 10000000000) return 10;
    return 11;
}

struct val {
    ll b, e, v;
    int l;
    val(ll b, ll e, int l) : b(b), e(e), v(pow(b, e)), l(l) {}
    string str() {
        return to_string(b) + "^" + to_string(e);
    }
};

bool operator<(const val& a, const val& b) {
    if (a.v != b.v) return a.v < b.v;
    return a.l < b.l;
}

bool operator<(const val& a, const ll b) {
    return a.v < b;
}

bool pred(const val& a, const val& b) {
    return a.v == b.v;
}

int main() {
    ll n = 1e10;
    cin >> n;
    vector<val> vals;
    for (ll base = 2; base*base <= n; base++) {
        for (ll exponent = 2; pow(base, exponent) <= n; exponent++) {
            vals.push_back(val(base, exponent, length(base) + length(exponent) + 1));
        }
    }
    sort(vals.begin(), vals.end());
    unique(vals.begin(), vals.end(), pred);

    string best = to_string(n);

    // Try a^b+c^d+e
    auto start = vals.begin();
    auto stop = vals.end();stop--;
    while (start != stop) {
        while (start != stop && start->v + stop->v > n) stop--;
        if (start == stop) break;
        ll l = start->l + stop->l + 1;
        if (start->v + stop->v != n) {
            l += 1 + length(n - start->v + stop->v);
        }
        if (l < best.size()) {
            best = start->str() + "+" + stop->str();
            if (start->v + stop->v != n) {
                best += string("+") + to_string(n - start->v + stop->v);
            }
        }
        start++;
    }

    // Try a*b^c+d
    for (auto ex : vals) {
        ll mul = n / ex.v;
        ll len = ex.l;
        if (mul > 1) len += 1 + length(mul);
        ll val = mul*ex.v;
        if (val < n) {
            len += 1 + length(n - val);
        }
        if (len < best.size()) {
            best = "";
            if (mul > 1)
                best += to_string(mul) + "*";
            best += ex.str();
            if (val < n)
                best += string("+") + to_string(n - val);
        }
    }

    // Try m*a^b+c^d
    for (auto ex : vals) {
        for (ll mul = 2; mul < 10; mul++) {
            ll needed = n - mul*ex.v;
            auto it = lower_bound(vals.begin(), vals.end(), needed);
            if (it != vals.end() && it->v == needed) {
                ll len = 2 + ex.l + 1 + it->l;
                if (len < best.size()) {
                    best = to_string(mul) + "*" + ex.str() + "+" + it->str();
                }
            }
        }
    }

    cout << best << endl;

    return 0;
    /*
    ll n;
    cin >> n;
    cout << construct(n) << endl;*/
}


#pragma GCC optimize("O3")
#pragma loop_opt(on)
#include<bits/stdc++.h>
#define int long long
#define debug(a) cout << #a << " = " << a << endl;
#define endl '\n'
#define REP(i,j,k) for(int i = j; i < k; ++i)
#define pb emplace_back
#define IOS ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
int n;
map<int,string> m;
signed main()
{IOS
	cin >> n;
	for(int i = 2; i*i <= n; ++i)
	{
		for(int j = i*i, k = 2; j <= n; j *= i, ++k)
		{
			string cur = to_string(i)+"^"+to_string(k);
			if(m.count(j) == 0) m[j] = cur;
			else if(m[j].size() > cur.size()) m[j] = cur;
		}
	}
	string ans = to_string(n);
	for(auto i:m)
	{
		int a = n/i.first, b = n%i.first;
		string cur = i.second;
		if(a > 1) cur += "*"+to_string(a);
		if(b) cur += "+"+(m.count(b)==0?to_string(b):m[b]);
		if(ans.size() > cur.size()) ans = cur;
	}
	cout << ans;
}


#pragma GCC optimize("O3")
#pragma loop_opt(on)
#include<bits/stdc++.h>
#define int long long
#define debug(a) cout << #a << " = " << a << endl;
#define endl '\n'
#define REP(i,j,k) for(int i = j; i < k; ++i)
#define pb emplace_back
#define IOS ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
int n;
map<int,string> m;
signed main()
{IOS
	cin >> n;
	for(int i = 2; i*i <= n; ++i)
	{
		for(int j = i*i, k = 2; j <= n; j *= i, ++k)
		{
			string cur = to_string(i)+"^"+to_string(k);
			if(cur.size() >= to_string(j).size()) continue;
			if(m.count(j) == 0) m[j] = cur;
			else if(m[j].size() > cur.size()) m[j] = cur;
		}
	}
	string ans = to_string(n);
	for(auto i:m)
	{
		int a = n/i.first, b = n%i.first;
		string cur = i.second;
		if(a > 1) cur += "*"+to_string(a);
		if(b) cur += "+"+(m.count(b)==0?to_string(b):m[b]);
		if(ans.size() > cur.size()) ans = cur;
	}
	cout << ans;
}


#pragma GCC optimize("O3")
#pragma loop_opt(on)
#include<bits/stdc++.h>
#define int long long
#define debug(a) cout << #a << " = " << a << endl;
#define endl '\n'
#define REP(i,j,k) for(int i = j; i < k; ++i)
#define pb emplace_back
#define IOS ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
int n;
map<int,string> m;
signed main()
{IOS
	cin >> n;
	for(int i = 2; i*i <= n; ++i)
	{
		for(int j = i*i, k = 2; j <= n; j *= i, ++k)
		{
			string cur = to_string(i)+"^"+to_string(k);
			if(cur.size() >= to_string(j).size()) continue;
			if(m.count(j) == 0) m[j] = cur;
			else if(m[j].size() > cur.size()) m[j] = cur;
		}
	}
	string ans = to_string(n);
	for(auto i:m)
	{
		int a = n/i.first, b = n%i.first;
		string cur = i.second;
		if(a > 1)
		{
			if(m.count(a) == 0) cur += "*"+to_string(a);
			else cur += "*"+m[a];
		}
		if(b) cur += "+"+(m.count(b)==0?to_string(b):m[b]);
		if(ans.size() > cur.size()) ans = cur;
	}
	cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

/*
9^8+9^9+1
177264450

*/

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		// e+A
		if (n - e.val > 0) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari e+A+B?
		// A mora da bude exp, inace mozemo da spojimo A+B u jedan broj
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		// e*A
		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C
		int ub = 9;
		if (e.len <= 3)
			ub = 999;
		else if (e.len == 4)
			ub = 99;
		for (int i=1; i<=ub; i++) {
			ll nn = n-i;
			if (nn < 1)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

/*
9^8+9^9+1
177264450

*/

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		// e+A
		if (n - e.val > 0) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari e+A+B?
		// A mora da bude exp, inace mozemo da spojimo A+B u jedan broj
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		// e*A
		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C
		int ub = 9;
		if (e.len == 3)
			ub = 999;
		else if (e.len == 4)
			ub = 99;
		for (int i=1; i<=ub; i++) {
			ll nn = n-i;
			if (nn < 1)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (naj[e.val].len > e.len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		if (e.val != n) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari a+B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		if (e.val != n) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari a+B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C
		int ub = 9;
		if (e.len <= 3)
			ub = 99;
		for (int i=1; i<=ub; i++) {
			ll nn = n-i;
			if (nn < 1)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

/*
9^8+9^9+1
177264450

*/

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		// e+A
		if (n - e.val > 0) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari e+A+B?
		// A mora da bude exp, inace mozemo da spojimo A+B u jedan broj
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		// e*A
		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C
		int ub = 9;
		if (e.len <= 3)
			ub = 999;
		else if (e.len == 4)
			ub = 99;
		for (int i=1; i<=ub; i++) {
			ll nn = n-i;
			if (nn < 1)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari e*i+A?
		for (int i=2; i<=9; i++) {
			ll nn = e.val*i;

			if (n - nn > 0) {
				string kand = to_string(e) + "*" + to_string(i)
					+ "+" + to_string(dajnaj(n - nn));
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		if (e.val != n) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari a+B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

/*
9^8+9^9+1
177264450

*/

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	if (n == 10'000'000'000ll)
		return cout << "100^5\n", 0;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (int i=1; i<=999; i++)
		baza.push_back({i, 1, cif(i), i});

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (e.len < naj[e.val].len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		if (n - e.val > 0) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		// tri stvari a+B+C?
		for (int i=1; i<=9; i++) {
			ll nn = n-i;
			if (nn - e.val < 1)
				continue;
			string kand = to_string(e) + "+" + to_string(dajnaj(nn - e.val))
				+ "+" + to_string(i);
			sejv(kand);
		}

		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		// tri stvari A*B+C
		int ub = 9;
		if (e.len <= 3)
			ub = 999;
		for (int i=1; i<=ub; i++) {
			ll nn = n-i;
			if (nn < 1)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "+" + to_string(i);
				sejv(kand);
			}
		}

		// tri stvari A*B*C?
		for (int i=2; i<=9; i++) {
			ll nn = n/i;
			if (n % i != 0)
				continue;
			if (nn % e.val == 0 && nn != e.val && e.val != 1) {
				string kand = to_string(e) + "*" + to_string(dajnaj(nn / e.val))
					+ "*" + to_string(i);
				sejv(kand);
			}
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int cif(ll x) {
	if (x == 0)
		return 1;
	int z = 0;
	while (x > 0) {
		z++;
		x /= 10;
	}
	return z;
}

struct eksp {
	ll a, b, len, val;
};

bool clen(const eksp& x, const eksp& y) {
	return x.len < y.len;
}

map<ll, eksp> naj;

vector<eksp> baza;

string to_string(eksp e) {
	if (e.b == 1)
		return to_string(e.a);
	return to_string(e.a) + "^" + to_string(e.b);
}

eksp dajnaj(ll vred) {
	if (naj.count(vred) && naj[vred].len < cif(vred))
		return naj[vred];

	return {vred, 1, cif(vred), vred};
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	ll n;
	cin >> n;

	for (int i=2; i<=100000; i++) {
		ll p = i;
		for (int j=2;; j++) {
			p *= i;
			if (p > n)
				break;
			baza.push_back({i, j, cif(i) + cif(j) + 1, p});
		}
	}

	for (eksp e : baza) {
		if (naj.count(e.val) == 0)
			naj[e.val] = e;
		else if (naj[e.val].len > e.len)
			naj[e.val] = e;
	}

	string sol = to_string(n);

	auto sejv = [&](string s) {
		if (s.size() < sol.size())
			sol = s;
	};

	// exp+exp
	for (eksp e : baza) {
		if (e.val != n) {
			string kand = to_string(e) + "+" + to_string(dajnaj(n - e.val));
			sejv(kand);
		}

		if (n % e.val == 0 && n != e.val && e.val != 1) {
			string kand = to_string(e) + "*" + to_string(dajnaj(n / e.val));
			sejv(kand);
		}

		if (e.val == n)
			sejv(to_string(e));
	}

	cout << sol << '\n';

}


#include<bits/stdc++.h>
using namespace std;
#define RI register int
typedef long long LL;
LL n,sqn;string ans;
map<LL,string> mp;
int main()
{
    cin>>n;
    sqn=sqrt(n);
    for(LL i=2;i<=sqn;++i) {
    	string ii=to_string(i);
    	if(!mp.count(i)||mp[i].length()>ii.length()) mp[i]=ii;
    	for(LL j=i*i,k=2;j<=n;j*=i,++k) {
    		string kl=ii+"^"+to_string(k);
    		if(!mp.count(j)||mp[j].length()>kl.length()) mp[j]=kl;
    	}
    }
    ans=to_string(n);
    for(map<LL,string>::iterator it=mp.begin();it!=mp.end();++it) {
    	string kl;LL x=(*it).first;
    	if(n/x!=1) {
    		string y=to_string(n/x);
    		if(mp.count(n/x)&&mp[n/x].length()<y.length()) kl+=mp[n/x]+"*";
    		else kl+=y+"*";
    	}
    	kl+=(*it).second;
    	if(n%x!=0) {
    		string y=to_string(n%x);
    		if(mp.count(n%x)&&mp[n%x].length()<y.length()) kl+="+"+mp[n%x];
    		else kl+="+"+y;
    	}
    	if(kl.length()<ans.length()) ans=kl;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
#define STR to_string
using namespace std;
unordered_map<long long, string> mp;
string best;
int main() {
	long long N; cin >> N;
	mp.reserve(100600);
	for (auto i = 2LL; i * i <= N; ++i) {
		auto k = i * i;
		for (auto j = 2LL; k <= N && k; ++j, k *= i) {
			string str = STR(i)+'^'+STR(j);
			if (str.size() > STR(k).size()) continue;
			auto & s = mp[k];
			if (!s.size()||s.size()>str.size()) s = move(str);
		}
	}
	best = STR(N);
	for (auto& p : mp) {
		string str;
		auto d = lldiv(N, p.first);
		if (d.quot > 1) {
			if (mp.count(d.quot)) str = mp[d.quot];
			else str = STR(d.quot);
			str += "*";
		}
		if (str.size()+p.second.size()>best.size()) continue;
		str += p.second;
		if (d.rem != 0) {
			str += "+";
			if (mp.count(d.rem)) str += mp[d.rem];
			else str += STR(d.rem);
		}
		if (str.size() < best.size()) best = str;
	}
	cout<< best <<"\n";
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const ll inf=(ll)5e18;
/*a^b-1//
c*a^b-1//
c+a^b-1//
a^c+b^d//
a^c*b^d//
a^b*c+d//
a^c+b^d*e
a^c+b^d+e
a^b*c^d+e
a^c*b^d*e*/
//+:1 *:2 ^:3

ll cal_len(ll x)
{
	ll ret=0;
	while(x) x/=10,ret++;
	return ret;
}

struct node
{
	ll B,T,V;
	bool operator < (const node &rhs) const{
		if(V==rhs.V) return cal_len(B)+cal_len(T)<cal_len(rhs.B)+cal_len(rhs.T);
		return V<rhs.V;
	}
	node(){}
	node(ll BB,ll TT,ll VV):B(BB),T(TT),V(VV){}
};
vector<node> f;
vector<ll> p;

ll n,a[10];
vector<ll> v[100001];
ll ans=10000; string str;
void init()
{
	for(ll i=2;i*i<=n;i++)
	{
		ll now=i; int Times=1;
		while(now<=n)
		{
			v[i].push_back(now);
			f.push_back(node(i,Times,now));
			p.push_back(now);
			now*=i; Times++;
		}
	}
}

char fc(ll x)
{
	if(x==1) return '+';
	if(x==2) return '*';
	return '^';
}

string fn(ll x)
{
	string ret;
	while(x)
	{
		ret=(char(x%10+'0'))+ret;
		x/=10;
	}
	return ret;
}

string get_str(ll len)
{
	string ret;
	for(int i=1;i<=len;i++)
	{
		if(i%2==1)
		{
			string tmp=fn(a[i]);
			ret=ret+tmp;
		}
		else ret=ret+(char)fc(a[i]);
	}
	return ret;
}

void subtask1()
{
	for(ll i=2;i*i<=n;i++)
	{
		for(ll j=0;j<(ll)v[i].size();j++)
		{
			ll x=i,y=j+1,val=v[i][j];
			ll d=n/val,r=n%val;
			if(d==0) continue;
			if(d==1&&r==0)//a^b
			{
				ll tt=1+cal_len(x)+cal_len(y);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y;
					str=get_str(3);
				}
			}
			if(d==1&&r!=0)//a^b+c
			{
				ll tt=2+cal_len(x)+cal_len(y)+cal_len(r);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=1,a[5]=r;
					str=get_str(5);
				}

				//a^b+c^d
				int pos=lower_bound(p.begin(),p.end(),r)-p.begin();
				if(p[pos]==r)
				{
					ll C=f[pos].B,D=f[pos].T;
					tt=3+cal_len(x)+cal_len(y)+cal_len(C)+cal_len(D);
					if(ans>tt)
					{
						ans=tt;
						a[1]=x,a[2]=3,a[3]=y,a[4]=1,a[5]=C,a[6]=3,a[7]=D;
						str=get_str(7);
					}
				}
			}
			if(d!=1&&r==0)//d*a^b
			{
				ll tt=2+cal_len(x)+cal_len(y)+cal_len(d);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=d;
					str=get_str(5);
				}

				//a^b*c^d
				int pos=lower_bound(p.begin(),p.end(),d)-p.begin();
				if(p[pos]==d)
				{
					ll C=f[pos].B,D=f[pos].T;
					tt=3+cal_len(x)+cal_len(y)+cal_len(C)+cal_len(D);
					if(ans>tt)
					{
						ans=tt;
						a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=C,a[6]=3,a[7]=D;
						str=get_str(7);
					}
				}
			}
			if(d!=1&&r!=0)//d*a^b+r
			{
				ll tt=3+cal_len(x)+cal_len(y)+cal_len(d)+cal_len(r);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=d,a[6]=1,a[7]=r;
					str=get_str(5);
				}
			}
		}
	}
}

ll power(ll x,ll y)
{
	ll ret=1;
	while(y--) ret*=x;
	return ret;
}

void subtask2()
{
	for(int A=1;A<10;A++)
	{
		for(int B=1;B<10;B++)
		{
			for(int C=1;C<10;C++)
			{
				for(int D=1;D<10;D++)
				{
					for(int E=1;E<10;E++)
					{
						if(power(A,B)+power(C,D)+E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=1,a[5]=C,a[6]=3,a[7]=D,a[8]=1,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)+power(C,D)*E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=1,a[5]=C,a[6]=3,a[7]=D,a[8]=2,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)*power(C,D)+E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=2,a[5]=C,a[6]=3,a[7]=D,a[8]=1,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)*power(C,D)*E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=2,a[5]=C,a[6]=3,a[7]=D,a[8]=2,a[9]=E;
								str=get_str(9);
							}
						}
					}
				}
			}
		}
	}
}

int main()
{
	scanf("%lld",&n);
	ans=cal_len(n); str=fn(n);
	init();
	sort(f.begin(),f.end());
	sort(p.begin(),p.end());
	subtask1();
	if(ans==10) subtask2();
	for(int i=0;i<(int)str.size();i++) printf("%c",str[i]);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const ll inf=(ll)5e18;
/*a^b-1//
c*a^b-1//
c+a^b-1//
a^c+b^d//
a^c*b^d//
a^b*c+d//
a^c+b^d*e
a^c+b^d+e
a^b*c^d+e
a^c*b^d*e*/
//+:1 *:2 ^:3

ll cal_len(ll x)
{
	ll ret=0;
	while(x) x/=10,ret++;
	return ret;
}

struct node
{
	ll B,T,V;
	bool operator < (const node &rhs) const{
		if(V==rhs.V) return cal_len(B)+cal_len(T)<cal_len(rhs.B)+cal_len(rhs.T);
		return V<rhs.V;
	}
	node(){}
	node(ll BB,ll TT,ll VV):B(BB),T(TT),V(VV){}
};
vector<node> f;
vector<ll> p;

ll n,a[10];
vector<ll> v[100001];
ll ans=10000; string str;
void init()
{
	for(ll i=2;i*i<=n;i++)
	{
		ll now=i; int Times=1;
		while(now<=n)
		{
			v[i].push_back(now);
			f.push_back(node(i,Times,now));
			p.push_back(now);
			now*=i; Times++;
		}
	}
}

char fc(ll x)
{
	if(x==1) return '+';
	if(x==2) return '*';
	return '^';
}

string fn(ll x)
{
	string ret;
	while(x)
	{
		ret=(char(x%10+'0'))+ret;
		x/=10;
	}
	return ret;
}

string get_str(ll len)
{
	string ret;
	for(int i=1;i<=len;i++)
	{
		if(i%2==1)
		{
			string tmp=fn(a[i]);
			ret=ret+tmp;
		}
		else ret=ret+(char)fc(a[i]);
	}
	return ret;
}

void subtask1()
{
	for(ll i=2;i*i<=n;i++)
	{
		for(ll j=0;j<(ll)v[i].size();j++)
		{
			ll x=i,y=j+1,val=v[i][j];
			ll d=n/val,r=n%val;
			if(d==0) continue;
			if(d==1&&r==0)//a^b
			{
				ll tt=1+cal_len(x)+cal_len(y);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y;
					str=get_str(3);
				}
			}
			if(d==1&&r!=0)//a^b+c
			{
				ll tt=2+cal_len(x)+cal_len(y)+cal_len(r);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=1,a[5]=r;
					str=get_str(5);
				}

				//a^b+c^d
				int pos=lower_bound(p.begin(),p.end(),r)-p.begin();
				if(p[pos]==r)
				{
					ll C=f[pos].B,D=f[pos].T;
					tt=3+cal_len(x)+cal_len(y)+cal_len(C)+cal_len(D);
					if(ans>tt)
					{
						ans=tt;
						a[1]=x,a[2]=3,a[3]=y,a[4]=1,a[5]=C,a[6]=3,a[7]=D;
						str=get_str(7);
					}
				}
			}
			if(d!=1&&r==0)//d*a^b
			{
				ll tt=2+cal_len(x)+cal_len(y)+cal_len(d);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=d;
					str=get_str(5);
				}

				//a^b*c^d
				int pos=lower_bound(p.begin(),p.end(),d)-p.begin();
				if(p[pos]==d)
				{
					ll C=f[pos].B,D=f[pos].T;
					tt=3+cal_len(x)+cal_len(y)+cal_len(C)+cal_len(D);
					if(ans>tt)
					{
						ans=tt;
						a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=C,a[6]=3,a[7]=D;
						str=get_str(7);
					}
				}
			}
			if(d!=1&&r!=0)//d*a^b+r
			{
				ll tt=3+cal_len(x)+cal_len(y)+cal_len(d)+cal_len(r);
				if(ans>tt)
				{
					ans=tt;
					a[1]=x,a[2]=3,a[3]=y,a[4]=2,a[5]=d,a[6]=1,a[7]=r;
					str=get_str(7);
				}
			}
		}
	}
}

ll power(ll x,ll y)
{
	ll ret=1;
	while(y--) ret*=x;
	return ret;
}

void subtask2()
{
	for(int A=1;A<10;A++)
	{
		for(int B=1;B<10;B++)
		{
			for(int C=1;C<10;C++)
			{
				for(int D=1;D<10;D++)
				{
					for(int E=1;E<10;E++)
					{
						if(power(A,B)+power(C,D)+E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=1,a[5]=C,a[6]=3,a[7]=D,a[8]=1,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)+power(C,D)*E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=1,a[5]=C,a[6]=3,a[7]=D,a[8]=2,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)*power(C,D)+E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=2,a[5]=C,a[6]=3,a[7]=D,a[8]=1,a[9]=E;
								str=get_str(9);
							}
						}
						if(power(A,B)*power(C,D)*E==n)
						{
							if(ans>9)
							{
								ans=9;
								a[1]=A,a[2]=3,a[3]=B,a[4]=2,a[5]=C,a[6]=3,a[7]=D,a[8]=2,a[9]=E;
								str=get_str(9);
							}
						}
					}
				}
			}
		}
	}
}

int main()
{
	scanf("%lld",&n);
	ans=cal_len(n); str=fn(n);
	init();
	sort(f.begin(),f.end());
	sort(p.begin(),p.end());
	subtask1();
	if(ans==10) subtask2();
	for(int i=0;i<(int)str.size();i++) printf("%c",str[i]);
	return 0;
}


#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
map<long long,int> ma;
map<long long,string> ma2;
int calc(long long x)
{
    int sum=0;
    for (;x!=0;)
    {
        x/=10;
        sum++;
    }
    return sum;
}
string get_string(long long x)
{
    string t="";
    for (;x!=0;)
    {
        t=(char)((x%10)+'0')+t;
        x/=10;
    }
    return t;
}
string t[100005];
int tt[100005];
map<long long,int> ma3;
map<long long,string> ma4;
int get_val(long long x)
{
    if (ma3.find(x)!=ma3.end()) return ma3[x];
    return calc(x);
}
string get_val2(long long x)
{
    if (ma4.find(x)!=ma4.end()) return ma4[x];
    if (x<=100000) return t[x];
    return get_string(x);
}
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int i;
    for (i=1;i<=100000;i++)
    {
        t[i]=get_string(i);
    }
    for (i=1;i<=100000;i++)
    {
        tt[i]=calc(i);
    }
    for (i=2;i<=100000;i++)
    {
        long long p=1;
        int j;
        for (j=1;;j++)
        {
            p*=i;
            if (p>10000000000ll) break;
            if (j==1) continue;
            if (calc(i)+calc(j)+1>=calc(p)) continue;
            if (p>=1000)
            {
                int ans=1000;
                if (ma.find(p)!=ma.end())
                {
                    ans=ma[p];
                }
                if (calc(i)+1+calc(j)<ans)
                {
                    ma[p]=tt[i]+1+tt[j];
                    ma2[p]=t[i]+"^"+t[j];
                }
            }
        }
    }
    //cout<<ma.size()<<endl;
    //a^b+c
    //a^b*c+d
    //a^b+c^d
    //a^b*c+d^e
    map<long long,int>::iterator ii;
    for (ii=ma.begin();ii!=ma.end();ii++)
    {
        ma3.insert(*ii);
        ma4[(*ii).first]=ma2[(*ii).first];
    }
    for (ii=ma.begin();ii!=ma.end();ii++)
    {
        int i;
        if ((*ii).second>3) continue;
        for (i=1;i<=9;i++)
        {
            int now=(*ii).first+i;
            if (calc(now)<=5) continue;
            ma3[now]=5;
            ma4[now]=ma2[(*ii).first]+"+"+(char)(i+'0');
        }
    }
    long long n;
    cin>>n;
    int min_ans=calc(n);
    string min_string=get_string(n);
    for (ii=ma.begin();ii!=ma.end();ii++)
    {
        if (n<(*ii).first) break;
        long long t=n-(*ii).first;
        int val;
        if (ma3.find(t)==ma3.end())
        {
            if (t>=1000000) continue;
        }
        else
        {
            if (ma3[t]>=6) continue;
        }
        string val2;
        if (n==(*ii).first)
        {
            val=(*ii).second;
            val2=ma2[(*ii).first];
        }
        else
        {
            val=(*ii).second+1+get_val(n-(*ii).first);
            val2=ma2[(*ii).first]+"+"+get_val2(n-(*ii).first);
        }
        if (val<min_ans)
        {
            min_ans=val;
            min_string=val2;
        }
    }
    for (ii=ma.begin();ii!=ma.end();ii++)
    {
        if (n<(*ii).first) break;
        int t=n/(*ii).first;
        if (t==1) continue;
        if (t>=100000) continue;
        long long p=n%(*ii).first;
        if (((ma.find(p)!=ma.end())&&(ma[p]<=3))||(p<1000))
        {
            int val;
            string val2;
            if (p==0)
            {
                val=(*ii).second+1+get_val(t);
                if (val>=min_ans) continue;
                val2=ma2[(*ii).first]+"*"+get_val2(t);
            }
            else
            {
                val=(*ii).second+1+get_val(t)+1+get_val(p);
                if (val>=min_ans) continue;
                val2=ma2[(*ii).first]+"*"+get_val2(t)+"+"+get_val2(p);
            }
            if (val<min_ans)
            {
                min_ans=val;
                min_string=val2;
            }
        }
    }
    cout<<min_string<<endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include<stdio.h>
#include<iomanip>
#include<set>
#include<string>
#include<map>
#include<bitset>
#include <math.h>
#include<iomanip>
#include<queue>
#include<complex>
using namespace std;
string ans;
map<long long, string> m;
set<long long> s[10];
set<long long>::iterator it1;
set<long long>::iterator it2;
long long n;
long long p10[10];
template<class T> string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}
int getlen(long long x)
{
    int k=0;
    while(x)
    {
        k++;
        x/=10;
    }
    return max(1,k);
}
void update(long long a, string b)
{
    if(a>n || b.size() >= getlen(a))
    return;
    if(m.find(a)!=m.end() && m[a].size()<=b.size())
    return;
    s[m[a].size()].erase(a);
    m[a]=b;
    s[b.size()].insert(a);
}
string get(long long a)
{
    if(m.find(a)!=m.end())
    return m[a];
    else
    return toString(a);
}
int  main()
{
    ios::sync_with_stdio(0);
cin.tie(0);
//freopen("windows.in","r",stdin);
//freopen("windows.out","w",stdout);
cin>>n;
if(n==1)
{
    cout<<"1";
    return 0;
}
ans=get(n);
p10[0]=1;
for(int i=1;i<=7;i++)
p10[i]=p10[i-1]*10;
for(long long i=2;i*i<=n;i++)
{
    int p=2;
    long long c=i*i;
    while(c<=n)
    {
        string s=toString(i)+"^"+toString(p);
        update(c,s);
        c*=i;
        p++;
    }
}
if(m.find(n)!=m.end() && ans.size()>m[n].size())
ans=m[n];
for(int i=1;i<=7;i++)
for(int j=i;j+i+1<=7;j++)
for(it1=s[i].begin();it1!=s[i].end();it1++)
for(it2=s[j].begin();it2!=s[j].end();it2++)
update((*it1)*(*it2),get((*it1))+"*"+get((*it2)));
for(int i=1;i<=5;i++)
for(long long j=1;j<=p10[6-i];j++)
for(it1=s[i].begin();it1!=s[i].end();it1++)
update(j*(*it1),toString(j)+"*"+get((*it1)));
for(int i=1;i*2+1<ans.size();i++)
{
    for(long long  j=1;j<=p10[i];j++)
    {
        string ss=get(n-j)+"+"+get(j);
        if(ss.size()<ans.size())
        ans=ss;
        if(n%j==0)
        {
            ss=get(n/j)+"*"+get(j);
            if(ss.size()<ans.size())
            ans=ss;
        }
    }
    for(it1=s[i].begin();it1!=s[i].end();it1++)
    {
        long long x=(*it1);
        string ss=get(n-x)+"+"+get(x);
        if(ss.size()<ans.size())
        ans=ss;
        if(n%x==0)
        {
            ss=get(n/x)+"*"+get(x);
            if(ss.size()<ans.size())
            ans=ss;
        }
    }
}
cout<<ans;
 return 0;
}


import math
import itertools

pow10 = [1]
for i in range(10):
    pow10.append(pow10[-1] * 10)

def getlen(x):
    """length of the decimal representation of integer x"""
    return int(math.log10(x)) + 1

class ShortestRepresentation:

    def __init__(self, n):
        self.n = n
        self._m = {}
        self._s = [set() for i in range(10)]

        self._generate_powers()
        self._generate_power_and_power(7)
        self._generate_simple_and_power(7)

    def _generate_powers(self):
        """add to the collection all expressions of the form a^b"""
        range_x = itertools.takewhile(
            lambda x: x**2 <= self.n,
            itertools.count(2))
        for x in range_x:
            c = x**2
            p = 2
            while c <= self.n:
                self.update(c, '{}^{}'.format(x, p))
                c *= x
                p += 1

    def _generate_power_and_power(self, maxlen):
        """add to the collection all expressions of the form a^b*c^d"""
        for i in range(1, maxlen + 1):
            range_j = itertools.takewhile(
                lambda j: i + j + 1 <= maxlen,
                itertools.count(i))
            for j in range_j:
                for x, y in itertools.product(self._s[i], self._s[j]):
                    x2 = self.get(x)
                    y2 = self.get(y)
                    self.update(x * y, '{}*{}'.format(x2, y2))

    def _generate_simple_and_power(self, maxlen):
        """add to the collection all expressions of the form a^b*c"""
        for i in range(1, maxlen - 1):
            range_xy = itertools.product(
                range(1, pow10[maxlen - 1 - i]),
                self._s[i])
            for x, y in range_xy:
                y2 = self.get(y)
                self.update(x * y, '{}*{}'.format(x, y2))

    def update(self, x, s):
        """update with s x'th entry of the collection"""
        if x > self.n:
            return

        ls = len(s)
        if ls >= getlen(x):  # length of s should be at least shorter
            return

        if x not in self._m:
            self._m[x] = s
            self._s[ls].add(x)
        else:
            lm = len(self._m[x])
            if ls < lm:
                self._s[lm].remove(x)
                self._m[x] = s
                self._s[ls].add(x)

    def get(self, x):
        """retrieve shortest valid representation of number x"""
        return self._m[x] if x in self._m else str(x)

n = int(input())
if n < 10**10:
    sr = ShortestRepresentation(n)
    ans = sr.get(n)

    # check a*b and a+b
    range_i = itertools.takewhile(
        lambda i: i * 2 + 1 < len(ans),
        itertools.count())
    for i in range_i:
        range_x = itertools.chain(
            range(1, pow10[i] + 1),
            sr._s[i])
        for x in range_x:
            ans = min(
                ans, '{}+{}'.format(sr.get(x), sr.get(n - x)), key=len)
            if n % x > 0:
                continue
            ans = min(
                ans, '{}*{}'.format(sr.get(x), sr.get(n // x)), key=len)

    print(ans)
else:
    print('100^5')


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public string ReadNextToken()
        {
            if (curTokenIdx >= curLine.Length)
            {
                //Read next line
                string line = reader.ReadLine();
                if (line != null)
                    curLine = line.Split(whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    curLine = new string[] { };
                curTokenIdx = 0;
            }

            if (curTokenIdx >= curLine.Length)
                return null;

            return curLine[curTokenIdx++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString();
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        long n;

        string ans;

        void UpdateAns(string newAns)
        {
            if (newAns.Length < ans.Length)
                ans = newAns;
        }

        public void Solve()
        {
            string nr = ioHelper.ReadNextToken();
            ans = nr;

            n = long.Parse(nr);

            if (n == 10000000000)
            {
                ans = "10^10";
            }

            long i, j, k, l;

            //5 termeni
            for (i = 1; i <= 9; i++)
                for (j = 1; j <= 9; j++)
                    for (k = 1; k <= 9; k++)
                        for (l = 1; l <= 9; l++)
                        {
                            //Choice 1;
                            long var = (long)(Math.Pow(i, j) * Math.Pow(k, l));
                            long delta = n - var;

                            if (delta == 0)
                                UpdateAns($"{i}^{j}*{k}^{l}");
                            if (delta > 0 && delta <= 9)
                                UpdateAns($"{i}^{j}*{k}^{l}+{delta}");

                            //Choice 1a;
                            var = (long)(Math.Pow(i, j) * Math.Pow(k, l));
                            delta = n / var;

                            if (delta * var == n)
                                UpdateAns($"{i}^{j}*{k}^{l}*{delta}");

                            //Choice 2
                            var = (long)(Math.Pow(i, j) * k * l);
                            delta = n - var;
                            if (delta == 0)
                                UpdateAns($"{i}^{j}*{k}*{l}");
                            if (delta > 0 && delta <= 9)
                                UpdateAns($"{i}^{j}*{k}*{l}+{delta}");

                            //Choice 3
                            var = (long)(Math.Pow(i, j) * k);
                            long delta1 = n - var;
                            if (delta1 == 0)
                                UpdateAns($"{i}^{j}*{k}");
                            else if (delta1 > 0)
                            {
                                long m = (long)Math.Pow(delta1, 1 / (double)l);

                                m--;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}^{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}^{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}^{l}");
                            }

                            //Choice 4
                            var = (long)(Math.Pow(i, j) * k);
                            delta1 = n - var;
                            if (delta1 == 0)
                                UpdateAns($"{i}^{j}*{k}");
                            else if (delta1 > 0)
                            {
                                long m = (long)(delta1 / l);

                                m--;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}*{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}*{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}^{j}*{k}+{m}*{l}");
                            }

                            //Choice 5
                            var = (long)(i * j * k * l);
                            delta = n - var;
                            if (delta == 0)
                                UpdateAns($"{i}*{j}*{k}*{l}");
                            if (delta > 0 && delta <= 9)
                                UpdateAns($"{i}*{j}*{k}*{l}+{delta}");

                            //Choice 6
                            var = (long)(i * j * k);
                            delta1 = n - var;
                            if (delta1 == 0)
                                UpdateAns($"{i}*{j}*{k}");
                            else if (delta1 > 0)
                            {
                                long m = (long)Math.Pow(delta1, 1 / (double)l);

                                m--;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}^{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}^{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)Math.Pow(m, l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}^{l}");
                            }

                            //Choice 7
                            var = (long)(i * j * k);
                            delta1 = n - var;
                            if (delta1 == 0)
                                UpdateAns($"{i}*{j}*{k}");
                            else if (delta1 > 0)
                            {
                                long m = (long)(delta1 / l);

                                m--;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}*{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}*{l}");

                                m++;
                                if (m >= 0 && m <= 9)
                                    if ((long)(m * l) == delta1)
                                        UpdateAns($"{i}*{j}*{k}+{m}*{l}");
                            }

                            //Choice 8
                            var = (long)(i * j * k * l);
                            delta = n / var;
                            if (delta == 1 && delta * var == n)
                                UpdateAns($"{i}*{j}*{k}*{l}");
                            if (delta > 0 && delta <= 9 && delta * var == n)
                                UpdateAns($"{i}*{j}*{k}*{l}*{delta}");
                        }

            //4 termeni
            for (i = 1; i <= 999; i++)
                for (j = 1; j <= ((i>=100)?9:((i>=10)?99:999)); j++)
                    for (k = 1; k <= (((i>=10 && j>=10)||(i>=100 || j>=100))?9: ((i>=10 || j >=10)?99:999)); k++)
                    {
                        //Choice 1
                        long var = (long)(Math.Pow(i, j));
                        long delta1 = n / var;

                        if (var == n)
                            UpdateAns($"{i}^{j}");

                        if(delta1 * var == n)
                        {
                            long m = (long)Math.Pow(delta1, 1 / (double)k);

                            m--;
                                if ((long)Math.Pow(m, k) == delta1)
                                    UpdateAns($"{i}^{j}*{k}^{m}");

                            m++;
                            if ((long)Math.Pow(m, k) == delta1)
                                UpdateAns($"{i}^{j}*{k}^{m}");

                            m++;
                            if ((long)Math.Pow(m, k) == delta1)
                                UpdateAns($"{i}^{j}*{k}^{m}");
                        }

                        //Choice 2
                        var = (long)(Math.Pow(i, j));
                        delta1 = n / var;

                        if(delta1 * var == n)
                        {

                            long m = (long)delta1/k;

                            m--;
                            if ((long)(m*k) == delta1)
                                UpdateAns($"{i}^{j}*{k}*{m}");

                            m++;
                            if ((long)(m * k) == delta1)
                                UpdateAns($"{i}^{j}*{k}*{m}");

                            m++;
                            if ((long)(m * k) == delta1)
                                UpdateAns($"{i}^{j}*{k}*{m}");
                        }

                        //Choice 2a
                        var = (long)(Math.Pow(i, j)*k);
                        delta1 = n - var;

                        if(delta1 > 0 )
                                UpdateAns($"{i}^{j}*{k}+{m}");

                        //Choice 3
                        var = (long)(Math.Pow(i, j));
                        delta1 = n - var;

                        if (delta1 > 0)
                        {
                            long m = (long)Math.Pow(delta1, 1 / (double)k);

                            m--;
                            if ((long)Math.Pow(m, k) == delta1)
                                UpdateAns($"{i}^{j}+{m}^{k}");

                            m++;
                            if ((long)Math.Pow(m, k) == delta1)
                                UpdateAns($"{i}^{j}+{m}^{k}");

                            m++;
                            if ((long)Math.Pow(m, k) == delta1)
                                UpdateAns($"{i}^{j}+{m}^{k}");
                        }

                        //Choice 4
                        var = (long)(Math.Pow(i, j));
                        delta1 = n - var;

                        if (delta1 > 0)
                        {

                            long m = (long)delta1 / k;

                            m--;
                            if ((long)(m * k) == delta1)
                                UpdateAns($"{i}^{j}+{k}*{m}");

                            m++;
                            if ((long)(m * k) == delta1)
                                UpdateAns($"{i}^{j}+{k}*{m}");

                            m++;
                            if ((long)(m * k) == delta1)
                                UpdateAns($"{i}^{j}+{k}*{m}");
                        }

                        //Choice 5
                        var = (long)(i * j * k);
                        delta1 = n / var;

                        if (var == n)
                            UpdateAns($"{i}*{j}*{k}");

                        if (delta1 * var == n)
                            UpdateAns($"{i}*{j}*{k}*{delta1}");

                        //Choice 6
                        var = (long)(i * j * k);
                        delta1 = n - var;

                        if (delta1 > 0 && delta1 < 1000)
                            UpdateAns($"{i}*{j}*{k}+{delta1}");
                    }

            //3 termeni
            long sqr = (long)Math.Sqrt(n)+1;
            for (i = 2; i <= sqr; i++)
                for(j = 2; j <= 33; j++)
                {
                    if (Math.Pow(i, j) > n)
                        break;

                    long var = (long)Math.Pow(i, j);

                    if (var == n)
                        UpdateAns($"{i}^{j}");

                    //Choice 1
                    long delta1 = n / var;
                    if (delta1 * var == n)
                        UpdateAns($"{i}^{j}*{delta1}");

                    //Choice 2
                    delta1 = n - var;
                    if (delta1 > 0 && delta1 < 100000)
                        UpdateAns($"{i}^{j}+{delta1}");
                }

            for (i = 2; i <= n/2; i++)
                {
                    j = n / i;
                    if (i.ToString().Length + j.ToString().Length + 1 > ans.Length)
                        break;

                    if (i*j > n)
                        break;

                    long var = (long)(i*j);

                    if (var == n)
                        UpdateAns($"{i}*{j}");

                    //Choice 1
                    long delta1 = n / var;
                    if (delta1 * var == n)
                        UpdateAns($"{i}*{j}*{delta1}");

                    //Choice 2
                    delta1 = n - var;
                    if (delta1 > 0 && delta1 < 100000)
                        UpdateAns($"{i}*{j}+{delta1}");
                }

            //2 termeni
            //Inclus in celelalte.

            ioHelper.WriteLine(ans);
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}