#include <bits/stdc++.h>

#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forn(i, n) fore(i, 0, n)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define for1(i, n) for(int i = 1; i < int(n); ++i)

#define mp make_pair
#define pb push_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

#define correct(x, y, xmax, ymax) ((x) >= 0 && (x) < (xmax) && (y) >= 0 && (y) < (ymax))
//#define max(a, b) ((a > b)? a : b)
//#define min(a, b) ((a < b)? a : b)
//#define abs(a) ((a < 0) ? -a : a)
//#define sqr(a) (a * a)

using namespace std;

template<class T> T gcd(T a, T b) { while(a > 0){ b %= a; swap(a, b);} return b; }
template<class T> T lcm(T a, T b) { return a / gcd (a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.x << ", " << p.y << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    forn(i, sz(v)) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

mt19937 myRand(time(NULL)); // [0, 2^32)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;
typedef vector <int> vi;

const int dx[] = {-1, 0, 1,  0};
const int dy[] = { 0, 1, 0, -1};
const int dxK[] = {-1, -1, 0, 1, 1,  1,  0, -1};
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1};
const int dxKn[] = {-2, -1, 1, 2,  2,  1, -1, -2};
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1};

const int INF = int(1e9) + 100;
const li INF64 = li(1e18) + 100;
const ld EPS = 1e-9;
const ld PI = acosl(-1.0);
const int N = 30009;

li n;
string s;
string bst[N];
map<li, string> bst2;

string tos(li a){
	if(a == 0) return "0";
	string res = "";
	while(a > 0) res += '0' + (a % 10), a /= 10;
	reverse(all(res));
	return res;
}

void precalc(){
	for(int i = 1; i < N; ++i) bst[i] = tos(i);
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < N; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(sz(ns) < sz(bst[cur])) bst[cur] = ns;
		}
	}

	for(int i = 2; i < N; ++i){
		for(int j = 2; j * j <= i; ++j){
			if(i % j != 0) continue;
			{
				int c = j;
				int c2 = i / j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
			{
				int c = i / j;
				int c2 = j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
		}
	}
//return;
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < 20000000000; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(!bst2.count(cur) || sz(bst2[cur]) > sz(ns))
				bst2[cur] = ns;
		}
	}
}

inline bool read() {
    if(!(cin >> s))
    	return false;
    return true;
}

string ans;

inline void solve() {
	//n = atoi(s.c_str());
//	cout << bst2[1953125] << endl;
	li n = 0;
	forn(i, sz(s)) n = 10LL * n + s[i] - '0';
//	cout << n << endl;
	ans = s;
	for(li a = 2; a <= N; ++a){
		li cur = a * a;

		for(li b = 2; cur <= n; ++b, cur *= a){
			for(li c = 2; c < 1000; ++c){
				li p = c * cur;
				li rem = n - p;
				if(rem < 0) break;
				string ns = tos(c) + "*" + tos(a) + "^" + tos(b);
				if(rem >= N) {
//					continue;
					if(bst2.count(rem)){
						string ns2 = ns + "+" + bst2[rem];
						if(sz(ans) > sz(ns2)) ans = ns2;
					}
					continue;
				}

				if(rem > 0){
					ns += "+" + bst[rem];
				}

				if(sz(ans) > sz(ns)) ans = ns;
			}

			{
				li p = cur;
				li rem = n - p;
				if(rem < 0) break;
				string ns = tos(a) + "^" + tos(b);
				if(rem >= N) {
//					continue;
					if(bst2.count(rem)){
						string ns2 = ns + "+" + bst2[rem];
						if(sz(ans) > sz(ns2)) ans = ns2;
					}
					continue;
				}

				if(rem > 0){
					ns += "+" + bst[rem];
				}

				if(sz(ans) > sz(ns)) ans = ns;
			}
		}
	}

	cout << ans << endl;
}

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    int tt = clock();
#endif
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
	precalc();
    int tc = 1;
	//cin >> tc;
    while(tc--) {
    	read();
        solve();

#ifdef _DEBUG
        cerr << "TIME = " << clock() - tt << endl;
        tt = clock();
#endif
    }

    return 0;
}


#include <bits/stdc++.h>

#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forn(i, n) fore(i, 0, n)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define for1(i, n) for(int i = 1; i < int(n); ++i)

#define mp make_pair
#define pb push_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

#define correct(x, y, xmax, ymax) ((x) >= 0 && (x) < (xmax) && (y) >= 0 && (y) < (ymax))
//#define max(a, b) ((a > b)? a : b)
//#define min(a, b) ((a < b)? a : b)
//#define abs(a) ((a < 0) ? -a : a)
//#define sqr(a) (a * a)

using namespace std;

template<class T> T gcd(T a, T b) { while(a > 0){ b %= a; swap(a, b);} return b; }
template<class T> T lcm(T a, T b) { return a / gcd (a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.x << ", " << p.y << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    forn(i, sz(v)) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

mt19937 myRand(time(NULL)); // [0, 2^32)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;
typedef vector <int> vi;

const int dx[] = {-1, 0, 1,  0};
const int dy[] = { 0, 1, 0, -1};
const int dxK[] = {-1, -1, 0, 1, 1,  1,  0, -1};
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1};
const int dxKn[] = {-2, -1, 1, 2,  2,  1, -1, -2};
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1};

const int INF = int(1e9) + 100;
const li INF64 = li(1e18) + 100;
const ld EPS = 1e-9;
const ld PI = acosl(-1.0);
const int N = 100009;

li n;
string s;
string bst[N];
map<li, string> bst2;

string tos(li a){
	if(a == 0) return "0";
	string res = "";
	while(a > 0) res += '0' + (a % 10), a /= 10;
	reverse(all(res));
	return res;
}

void precalc(){
	for(int i = 1; i < N; ++i) bst[i] = tos(i);
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < N; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(sz(ns) < sz(bst[cur])) bst[cur] = ns;
		}
	}

	for(int i = 2; i < N; ++i){
		for(int j = 2; j * j <= i; ++j){
			if(i % j != 0) continue;
			{
				int c = j;
				int c2 = i / j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
			{
				int c = i / j;
				int c2 = j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
		}
	}
//return;
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < 20000000000; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(!bst2.count(cur) || sz(bst2[cur]) > sz(ns))
				bst2[cur] = ns;
		}
	}
}

inline bool read() {
    if(!(cin >> s))
    	return false;
    return true;
}

string ans;

inline void solve() {
	//n = atoi(s.c_str());
//	cout << bst2[1953125] << endl;
	li n = 0;
	forn(i, sz(s)) n = 10LL * n + s[i] - '0';
//	cout << n << endl;
	ans = s;
	for(li a = 2; a <= N; ++a){
		li cur = a * a;

		for(li b = 2; cur <= n; ++b, cur *= a){

			for(int add = 0; add < 100; ++add){

				li rem = n - add;

				if(rem <= 0) break;
				if(rem % cur != 0) continue;
				rem /= cur;

				string ns = tos(a) + "^" + tos(b);
				string x = tos(rem);
				if(bst2.count(rem) && sz(bst2[rem]) < sz(x)) x = bst2[rem];
				if(rem < N && sz(x) > sz(bst[rem])) x = bst[rem];
				ns += "*" + x;
				if(add > 0) ns += "+" + tos(add);
				if(sz(ns) < sz(ans)) ans = ns;
//				string ns = bst[rem] + "*" +
			}

			for(li c = 2; c < 400; ++c){
				li p = c * cur;
				li rem = n - p;
				if(rem < 0) break;
				string ns = tos(c) + "*" + tos(a) + "^" + tos(b);
				if(rem >= N) {
//					continue;
					if(bst2.count(rem)){
						string ns2 = ns + "+" + bst2[rem];
						if(sz(ans) > sz(ns2)) ans = ns2;
					}
					continue;
				}

				if(rem > 0){
					ns += "+" + bst[rem];
				}

				if(sz(ans) > sz(ns)) ans = ns;
			}
			if(n % cur == 0){

				li rem = n / cur;
				string ns = tos(a) + "^" + tos(b) + "*";
				string add = tos(rem);
				if(bst2.count(rem) && sz(bst2[rem]) < sz(add))
					add = bst2[rem];
				if(rem < N && sz(bst[rem]) < sz(add))
					add = bst[rem];
				ns += add;//if(cur == 59049) cout << ns << endl;
				if(sz(ans) > sz(ns)) ans = ns;
			}

			{
				li p = cur;
				li rem = n - p;
				if(rem < 0) break;
				string ns = tos(a) + "^" + tos(b);
				if(rem >= N) {
//					continue;
					if(bst2.count(rem)){
						string ns2 = ns + "+" + bst2[rem];
						if(sz(ans) > sz(ns2)) ans = ns2;
					}
			//		continue;
				}
				if(rem == 0){
					if(sz(ans) > sz(ns)) ans = ns;
				}
				if(rem > 0 && rem < N){
					ns += "+" + bst[rem];
					if(sz(ans) > sz(ns)) ans = ns;
				}

			}

		}
	}

	cout << ans << endl;
}

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    int tt = clock();
#endif
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
	precalc();
    int tc = 1;
	//cin >> tc;
    while(tc--) {
    	read();
        solve();//3424342

#ifdef _DEBUG
        cerr << "TIME = " << clock() - tt << endl;
        tt = clock();
#endif
    }

    return 0;
}


#include <bits/stdc++.h>

#define fore(i, l, r) for(int i = int(l); i < int(r); ++i)
#define forn(i, n) fore(i, 0, n)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define for1(i, n) for(int i = 1; i < int(n); ++i)

#define mp make_pair
#define pb push_back
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

#define correct(x, y, xmax, ymax) ((x) >= 0 && (x) < (xmax) && (y) >= 0 && (y) < (ymax))
//#define max(a, b) ((a > b)? a : b)
//#define min(a, b) ((a < b)? a : b)
//#define abs(a) ((a < 0) ? -a : a)
//#define sqr(a) (a * a)

using namespace std;

template<class T> T gcd(T a, T b) { while(a > 0){ b %= a; swap(a, b);} return b; }
template<class T> T lcm(T a, T b) { return a / gcd (a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

template<class A, class B> ostream& operator <<(ostream &out, const pair<A, B> &p) {
    return out << "(" << p.x << ", " << p.y << ")";
};

template<class A> ostream& operator <<(ostream &out, const vector<A> &v) {
    out << "[";
    forn(i, sz(v)) {
        if(i)
            out << ", ";
        out << v[i];
    }
    return out << "]";
}

mt19937 myRand(time(NULL)); // [0, 2^32)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;
typedef vector <int> vi;

const int dx[] = {-1, 0, 1,  0};
const int dy[] = { 0, 1, 0, -1};
const int dxK[] = {-1, -1, 0, 1, 1,  1,  0, -1};
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1};
const int dxKn[] = {-2, -1, 1, 2,  2,  1, -1, -2};
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1};

const int INF = int(1e9) + 100;
const li INF64 = li(1e18) + 100;
const ld EPS = 1e-9;
const ld PI = acosl(-1.0);
const int N = 100009;

li n;
string s;
string bst[N];
map<li, string> bst2;

string tos(li a){
	if(a == 0) return "0";
	string res = "";
	while(a > 0) res += '0' + (a % 10), a /= 10;
	reverse(all(res));
	return res;
}

void precalc(){
	for(int i = 1; i < N; ++i) bst[i] = tos(i);
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < N; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(sz(ns) < sz(bst[cur])) bst[cur] = ns;
		}
	}

	for(int i = 2; i < N; ++i){
		for(int j = 2; j * j <= i; ++j){
			if(i % j != 0) continue;
			{
				int c = j;
				int c2 = i / j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
			{
				int c = i / j;
				int c2 = j;
				string ns = bst[c] + "*" + bst[c2];
				if(sz(ns) < sz(bst[i])) bst[i] = ns;
			}
		}
	}
//return;
	for(int i = 2; i < N; ++i){
		li cur = i * 1LL * i;
		for(int x = 2; cur < 20000000000; cur *= i, ++x){
			string ns = tos(i) + "^" + tos(x);
			if(!bst2.count(cur) || sz(bst2[cur]) > sz(ns))
				bst2[cur] = ns;
		}
	}
}

inline bool read() {
    if(!(cin >> s))
    	return false;
    return true;
}

string ans;

inline void solve() {
	//n = atoi(s.c_str());
//	cout << bst2[1953125] << endl;
	li n = 0;
	forn(i, sz(s)) n = 10LL * n + s[i] - '0';
//	cout << n << endl;
	ans = s;
	for(li a = 2; a <= N; ++a){
		li cur = a * a;

		for(li b = 2; cur <= n; ++b, cur *= a){

			for(int add = 0; add < 100; ++add){

				li rem = n - add;

				if(rem <= 0) break;
				if(rem % cur != 0) continue;
				rem /= cur;

				string ns = tos(a) + "^" + tos(b);
				string x = tos(rem);
				if(bst2.count(rem) && sz(bst2[rem]) < sz(x)) x = bst2[rem];
				if(rem < N && sz(x) > sz(bst[rem])) x = bst[rem];
				ns += "*" + x;
				if(add > 0) ns += "+" + tos(add);
				if(sz(ns) < sz(ans)) ans = ns;
//				string ns = bst[rem] + "*" +
			}

			if(n % cur == 0){

				li rem = n / cur;
				string ns = tos(a) + "^" + tos(b) + "*";
				string add = tos(rem);
				if(bst2.count(rem) && sz(bst2[rem]) < sz(add))
					add = bst2[rem];
				if(rem < N && sz(bst[rem]) < sz(add))
					add = bst[rem];
				ns += add;//if(cur == 59049) cout << ns << endl;
				if(sz(ans) > sz(ns)) ans = ns;
			}

			{
				li p = cur;
				li rem = n - p;
				if(rem < 0) break;
				string ns = tos(a) + "^" + tos(b);
				if(rem >= N) {
//					continue;
					if(bst2.count(rem)){
						string ns2 = ns + "+" + bst2[rem];
						if(sz(ans) > sz(ns2)) ans = ns2;
					}
			//		continue;
				}
				if(rem == 0){
					if(sz(ans) > sz(ns)) ans = ns;
				}
				if(rem > 0 && rem < N){
					ns += "+" + bst[rem];
					if(sz(ans) > sz(ns)) ans = ns;
				}

			}

		}
	}

	cout << ans << endl;
}

int main() {
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    int tt = clock();
#endif
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(15);
	precalc();
    int tc = 1;
	//cin >> tc;
    while(tc--) {
    	read();
        solve();

#ifdef _DEBUG
        cerr << "TIME = " << clock() - tt << endl;
        tt = clock();
#endif
    }

    return 0;
}


/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
const LL MAX_N = 10000000000LL;
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1){
            res*=x;
            res=min(res,MAX_N);
        }
        y>>=1;
        x=x*x;
        x=min(x,MAX_N);
    }
    return res;
}
string an;
char tmp[SIZE];
void update(){
    string ss(tmp);
    if(SZ(ss)<SZ(an))an=ss;
}
int dc[SIZE];
int main(){
    REPP(i,1,SIZE){
        dc[i]=1+dc[i/10];
    }
    LL n; R(n);
    if(n==MAX_N){
        W("100^5");
        return 0;
    }
    an=to_string(n);
    FOR(a,1,9)FOR(b,1,9)FOR(c,1,9)FOR(d,1,9)FOR(e,1,9){
        if(a*mypow(b,c)+mypow(d,e)==n){
            if(a!=1){
                sprintf(tmp,"%d*%d^%d+%d^%d",a,b,c,d,e);
            }
            else{
                sprintf(tmp,"%d^%d+%d^%d",b,c,d,e);
            }
            update();
        }
    }
    FOR(a,1,9)FOR(b,1,9)FOR(c,1,9)FOR(d,1,9)FOR(e,1,9){
        if(mypow(a,b)*mypow(c,d)+e==n){
            sprintf(tmp,"%d^%d*%d^%d+%d",a,b,c,d,e);
            update();
        }
    }
    for(LL b=2;b*b<=n;b++){
        if(n%(b*b)==0){
            LL now=b*b;
            int c=2;
            while(n%now==0){
                if(n==now){
                    sprintf(tmp,"%lld^%d",b,c);
                }
                else{
                    sprintf(tmp,"%lld*%lld^%d",n/now,b,c);
                }
                now*=b;
                c++;
            }
            update();
        }
    }
    for(LL b=2;b<1000;b++){
        LL v=b*b;
        for(LL c=2;v<=n;c++,v*=b){
            for(LL a=1;a<1000&&a*v<=n;a++){
                sprintf(tmp,"%lld*%lld^%lld+%lld",a,b,c,n-a*v);
                update();
            }
        }
    }
    for(LL b=2;b*b<=n;b++){
        LL v=b*b;
        for(LL c=2;v<=n;c++,v*=b){
            sprintf(tmp,"%lld^%lld+%lld",b,c,n-v);
            update();
        }
    }
    for(LL a=2;a<1000;a++){
        LL v1=a*a;
        for(LL b=2;v1<n;b++,v1*=a){
            for(LL c=a;c<1000;c++){
                LL v2=c*c;
                LL d=2;
                while(v1+v2<n){
                    d++;
                    v2*=c;
                }
                if(v1+v2==n){
                    sprintf(tmp,"%lld^%lld+%lld^%lld",a,b,c,d);
                    update();
                }
            }
        }
    }
    W(an);
    return 0;
}


/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
const LL MAX_N = 10000000000LL;
LL mypow(LL x,LL y){
    LL res=1;
    while(y){
        if(y&1){
            res*=x;
            res=min(res,MAX_N);
        }
        y>>=1;
        x=x*x;
        x=min(x,MAX_N);
    }
    return res;
}
string an;
char tmp[SIZE];
void update(){
    string ss(tmp);
    if(SZ(ss)<SZ(an))an=ss;
}
int dc[SIZE];
int main(){
    REPP(i,1,SIZE){
        dc[i]=1+dc[i/10];
    }
    LL n; R(n);
    if(n==MAX_N){
        W("100^5");
        return 0;
    }
    an=to_string(n);
    FOR(a,1,9)FOR(b,1,9)FOR(c,1,9)FOR(d,1,9)FOR(e,1,9){
        if(a*mypow(b,c)+mypow(d,e)==n){
            if(a!=1){
                sprintf(tmp,"%d*%d^%d+%d^%d",a,b,c,d,e);
            }
            else{
                sprintf(tmp,"%d^%d+%d^%d",b,c,d,e);
            }
            update();
        }
    }
    for(LL b=2;b*b<=n;b++){
        if(n%(b*b)==0){
            LL now=b*b;
            int c=2;
            while(n%now==0){
                if(n==now){
                    sprintf(tmp,"%lld^%d",b,c);
                }
                else{
                    sprintf(tmp,"%lld*%lld^%d",n/now,b,c);
                }
                now*=b;
                c++;
            }
            update();
        }
    }
    for(LL b=2;b<1000;b++){
        LL v=b*b;
        for(LL c=2;v<=n;c++,v*=b){
            for(LL a=1;a<1000&&a*v<=n;a++){
                sprintf(tmp,"%lld*%lld^%lld+%lld",a,b,c,n-a*v);
                update();
            }
        }
    }
    for(LL b=2;b*b<=n;b++){
        LL v=b*b;
        for(LL c=2;v<=n;c++,v*=b){
            sprintf(tmp,"%lld^%lld+%lld",b,c,n-v);
            update();
        }
    }
    for(LL a=2;a<1000;a++){
        LL v1=a*a;
        for(LL b=2;v1<n;b++,v1*=a){
            for(LL c=a;c<1000;c++){
                LL v2=c*c;
                LL d=2;
                while(v1+v2<n){
                    d++;
                    v2*=c;
                }
                if(v1+v2==n){
                    sprintf(tmp,"%lld^%lld+%lld^%lld",a,b,c,d);
                    update();
                }
            }
        }
    }
    W(an);
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,n)	for(int i=0;i<(int)n;i++)
#define FOB(i,n)	for(int i=n;i>=1;i--)
#define MP(x,y)	make_pair((x),(y))
#define ii pair<int, int>
#define lli long long int
#define ulli unsigned long long int
#define lili pair<lli, lli>
#ifdef EBUG
#define DBG	if(1)
#else
#define DBG	if(0)
#endif
#define SIZE(x) int(x.size())
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;

typedef complex<long double> point;

template<class T>
T get() {
    T a;
    cin >> a;
    return a;
}

template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U> &par) {
    out << "[" << par.first << ";" << par.second << "]";
    return out;
}

template <class T>
ostream& operator<<(ostream& out, const set<T> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}";
    return out;
}

template <class T, class U>
ostream& operator<<(ostream& out, const map<T,U> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}"; return out;
}

template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  FOR(i, v.size()){
    if(i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}

bool ccw(point p, point a, point b){
  if((conj(a - p) * (b - p)).imag() <= 0) return(0);
  else return(1);
}

int main(){
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    lli n = get<lli>();
    string s = to_string(n);
    int m = s.size();
    int mini = m;
    string minis = s;

    vector<vector<lli> > exp(1, vector<lli>(1, 1));
    map<lli, lili> E;

    for(lli a = 2; a * a <= n; a ++) {
        exp.push_back(vector<lli>(0));
        lli last = 1;
        exp[a - 1].push_back(last);

        lli pw = 0;

        while(last < n) {
            last = last * a;
            if(last > n) break;
            pw ++;
            exp[a - 1].push_back(last);
            if(pw > 1) {
                if(E.find(last) == E.end()) E[last] = {a, pw};
                else {
                    if((to_string(a) + to_string(pw)).size() < (to_string(E[last].first) + to_string(E[last].second)).size()) E[last] = {a, pw};
                }
            }
        }
    }

    DBG cout << "E: " << E << endl;

    for(auto &ex : E) {
        if(ex.first > n) break;
        if(ex.first == n) {
            if((to_string(ex.second.first) + to_string(ex.second.second)).size() + 1 < mini) {
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second);
                mini = minis.size();
            }
        }
        else {
            lli rem = n - ex.first;
            if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                DBG cout << rem << " + " << ex << " = n " << endl;
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rem);
                mini = minis.size();
            }
            if(n % ex.first == 0) {
                lli rem = n / ex.first;
                if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second);
                    mini = minis.size();
                }
            }
            else {
                lli rem = n / ex.first;
                lli rm = n - rem * ex.first;
                if((to_string(ex.second.first) + to_string(rm) + to_string(ex.second.second) + to_string(rem)).size() + 3 < mini) {
                    DBG cout << " = " << rem << " * " << ex << endl;
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rm);
                    mini = minis.size();
                }
            }
            auto it = E.upper_bound(n - ex.first);
            if(it != E.begin()) {
                it --;
                string news = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+"
                            + to_string(it -> second.first) + "^" + to_string(it -> second.second);
                if(it -> first + ex.first == n) {if(news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
                else {
                    news += "+" + to_string(n - ex.first - it -> first);
                    if((int)news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
            }
        }
    }

    DBG cout << "minis now: " << minis << endl;

    // hlupa vec

    if(mini > 9) {
        FOR(a, 10) {
            if(a < 2) continue;
            FOR(b, 10) {
                if(b < 2) continue;
                FOR(c, 10) {
                    if(c < 2) continue;
                    FOR(d, 10) {
                        if(d < 2) continue;
                        FOR(e, 10) {
                            if(e < 2) continue;

                            lli cis = (lli)e * exp[a - 1][b] + exp[c - 1][d];
                            if(cis == n) {
                                mini = 9;
                                minis = to_string(e) + "*" + to_string(a) + "^" + to_string(b) + "+" + to_string(c) + "^" + to_string(d);
                                break;
                            }
                            cis = e + exp[a - 1][b] * exp[c - 1][d];
                            if(cis == n) {
                                mini = 9;
                                minis = to_string(e) + "*" + to_string(a) + "^" + to_string(b) + "+" + to_string(c) + "^" + to_string(d);
                                break;
                            }

                        }
                    }
                }
            }
        }
    }

    cout << minis << endl;

}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,n)	for(int i=0;i<(int)n;i++)
#define FOB(i,n)	for(int i=n;i>=1;i--)
#define MP(x,y)	make_pair((x),(y))
#define ii pair<int, int>
#define lli long long int
#define ulli unsigned long long int
#define lili pair<lli, lli>
#ifdef EBUG
#define DBG	if(1)
#else
#define DBG	if(0)
#endif
#define SIZE(x) int(x.size())
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;

typedef complex<long double> point;

template<class T>
T get() {
    T a;
    cin >> a;
    return a;
}

template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U> &par) {
    out << "[" << par.first << ";" << par.second << "]";
    return out;
}

template <class T>
ostream& operator<<(ostream& out, const set<T> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}";
    return out;
}

template <class T, class U>
ostream& operator<<(ostream& out, const map<T,U> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}"; return out;
}

template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  FOR(i, v.size()){
    if(i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}

bool ccw(point p, point a, point b){
  if((conj(a - p) * (b - p)).imag() <= 0) return(0);
  else return(1);
}

int main(){
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    lli n = get<lli>();
    string s = to_string(n);
    int m = s.size();
    int mini = m;
    string minis = s;

    vector<vector<lli> > exp(1, vector<lli>(1, 1));
    map<lli, lili> E;

    for(lli a = 2; a * a <= n; a ++) {
        exp.push_back(vector<lli>(0));
        lli last = 1;
        exp[a - 1].push_back(last);

        lli pw = 0;

        while(last < n) {
            last = last * a;
            if(last > n) break;
            pw ++;
            exp[a - 1].push_back(last);
            if(pw > 1) {
                if(E.find(last) == E.end()) E[last] = {a, pw};
                else {
                    if((to_string(a) + to_string(pw)).size() < (to_string(E[last].first) + to_string(E[last].second)).size()) E[last] = {a, pw};
                }
            }
        }
    }

    DBG cout << "E: " << E << endl;

    for(auto &ex : E) {
        if(ex.first > n) break;
        if(ex.first == n) {
            if((to_string(ex.second.first) + to_string(ex.second.second)).size() + 1 < mini) {
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second);
                mini = minis.size();
            }
        }
        else {
            lli rem = n - ex.first;
            if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                DBG cout << rem << " + " << ex << " = n " << endl;
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rem);
                mini = minis.size();
            }
            if(n % ex.first == 0) {
                lli rem = n / ex.first;
                if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second);
                    mini = minis.size();
                }
            }
            else {
                lli rem = n / ex.first;
                lli rm = n - rem * ex.first;
                if((to_string(ex.second.first) + to_string(rm) + to_string(ex.second.second) + to_string(rem)).size() + 3 < mini) {
                    DBG cout << " = " << rem << " * " << ex << endl;
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rm);
                    mini = minis.size();
                }
            }
            auto it = E.upper_bound(n - ex.first);
            if(it != E.begin()) {
                it --;
                string news = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+"
                            + to_string(it -> second.first) + "^" + to_string(it -> second.second);
                if(it -> first + ex.first == n) {if(news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
                else {
                    news += "+" + to_string(n - ex.first - it -> first);
                    if((int)news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
            }
        }
    }

    DBG cout << "minis now: " << minis << endl;

    // hlupa vec

    if(mini > 9) {
        FOR(a, 10) {
            if(a < 2) continue;
            FOR(b, 10) {
                if(b < 2) continue;
                FOR(c, 10) {
                    if(c < 2) continue;
                    FOR(d, 10) {
                        if(d < 2) continue;
                        FOR(e, 10) {
                            if(e < 2) continue;

                            lli cis = (lli)e * exp[a - 1][b] + exp[c - 1][d];
                            if(cis == n) {
                                mini = 9;
                                minis = to_string(e) + "*" + to_string(a) + "^" + to_string(b) + "+" + to_string(c) + "^" + to_string(d);
                                break;
                            }

                        }
                    }
                }
            }
        }
    }

    cout << minis << endl;

}


#include<bits/stdc++.h>

using namespace std;

#define FOR(i,n)	for(int i=0;i<(int)n;i++)
#define FOB(i,n)	for(int i=n;i>=1;i--)
#define MP(x,y)	make_pair((x),(y))
#define ii pair<int, int>
#define lli long long int
#define ulli unsigned long long int
#define lili pair<lli, lli>
#ifdef EBUG
#define DBG	if(1)
#else
#define DBG	if(0)
#endif
#define SIZE(x) int(x.size())
const int infinity = 2000000999 / 2;
const long long int inff = 4000000000000000999;

typedef complex<long double> point;

template<class T>
T get() {
    T a;
    cin >> a;
    return a;
}

template <class T, class U>
ostream& operator<<(ostream& out, const pair<T, U> &par) {
    out << "[" << par.first << ";" << par.second << "]";
    return out;
}

template <class T>
ostream& operator<<(ostream& out, const set<T> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}";
    return out;
}

template <class T, class U>
ostream& operator<<(ostream& out, const map<T,U> &cont){
    out << "{";
    for (const auto &x:cont) out << x << ", ";
    out << "}"; return out;
}

template <class T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  FOR(i, v.size()){
    if(i) out << " ";
    out << v[i];
  }
  out << endl;
  return out;
}

bool ccw(point p, point a, point b){
  if((conj(a - p) * (b - p)).imag() <= 0) return(0);
  else return(1);
}

int main(){
    cin.sync_with_stdio(false);
    cout.sync_with_stdio(false);
    lli n = get<lli>();
    string s = to_string(n);
    int m = s.size();
    int mini = m;
    string minis = s;

    vector<vector<lli> > exp(1, vector<lli>(1, 1));
    map<lli, lili> E;

    for(lli a = 2; a * a <= n; a ++) {
        exp.push_back(vector<lli>(0));
        lli last = 1;
        exp[a - 1].push_back(last);

        lli pw = 0;

        while(last < n) {
            last = last * a;
            if(last > n) break;
            pw ++;
            exp[a - 1].push_back(last);
            if(pw > 1) {
                if(E.find(last) == E.end()) E[last] = {a, pw};
                else {
                    if((to_string(a) + to_string(pw)).size() < (to_string(E[last].first) + to_string(E[last].second)).size()) E[last] = {a, pw};
                }
            }
        }
    }

    DBG cout << "E: " << E << endl;

    for(auto &ex : E) {
        if(ex.first > n) break;
        if(ex.first == n) {
            if((to_string(ex.second.first) + to_string(ex.second.second)).size() + 1 < mini) {
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second);
                mini = minis.size();
            }
        }
        else {
            lli rem = n - ex.first;
            if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                DBG cout << rem << " + " << ex << " = n " << endl;
                minis = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rem);
                mini = minis.size();
            }
            if(n % ex.first == 0) {
                lli rem = n / ex.first;
                if((to_string(ex.second.first) + to_string(ex.second.second) + to_string(rem)).size() + 2 < mini) {
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second);
                    mini = minis.size();
                }
            }
            else {
                lli rem = n / ex.first;
                lli rm = n - rem * ex.first;
                if((to_string(ex.second.first) + to_string(rm) + to_string(ex.second.second) + to_string(rem)).size() + 3 < mini) {
                    DBG cout << " = " << rem << " * " << ex << endl;
                    minis = to_string(rem) + "*" + to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+" + to_string(rm);
                    mini = minis.size();
                }
            }
            auto it = E.upper_bound(n - ex.first);
            if(it != E.begin()) {
                it --;
                string news = to_string(ex.second.first) + "^" + to_string(ex.second.second) + "+"
                            + to_string(it -> second.first) + "^" + to_string(it -> second.second);
                if(it -> first + ex.first == n) {if(news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
                else {
                    news += "+" + to_string(n - ex.first - it -> first);
                    if((int)news.size() < mini) {
                        mini = news.size();
                        minis = news;
                    }
                }
            }
        }
    }

    DBG cout << "minis now: " << minis << endl;

    // hlupa vec

    if(mini > 9) {
        FOR(a, 10) {
            if(a < 2) continue;
            FOR(b, 10) {
                if(b < 2) continue;
                FOR(c, 10) {
                    if(c < 2) continue;
                    FOR(d, 10) {
                        if(d < 2) continue;
                        FOR(e, 10) {
                            if(e < 2) continue;

                            lli cis = (lli)e * exp[a - 1][b] + exp[c - 1][d];
                            if(cis == n) {
                                mini = 9;
                                minis = to_string(e) + "*" + to_string(a) + "^" + to_string(b) + "+" + to_string(c) + "^" + to_string(d);
                                break;
                            }
                            cis = e + exp[a - 1][b] * exp[c - 1][d];
                            if(cis == n) {
                                mini = 9;
                                minis = to_string(e) + "+" + to_string(a) + "^" + to_string(b) + "*" + to_string(c) + "^" + to_string(d);
                                break;
                            }

                        }
                    }
                }
            }
        }
    }

    cout << minis << endl;

}


#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define pc putchar
#define ite map<int,string>::iterator
#define fi first
#define se second
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
using namespace std;
int n;
map<int,string> ma;
string ans;
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);}
void writeln(int x){write(x),hh;}
void writesp(int x){write(x),pc(' ');}
signed main(){
	n=read();
	ans=to_string(n);
	int sq=sqrt(n);
	for(int a=2;a<=sq;a++){
		int x=1,now=a;
		while(now*a<=n){
			x++;
			now*=a;
			string t=to_string(a)+"^"+to_string(x);
			if(!ma.count(now)) ma[now]=t;
			else if(ma[now].size()>t.size()) ma[now]=t;
		}
	}
	for(ite it=ma.begin();it!=ma.end();it++){
		string res=it->se;
		if(n/it->fi>1){
			res=res+"*";
			if(ma.count(n/it->fi)) res=res+ma[n/it->fi];
			else res=res+to_string(n/it->fi);
		}
		if(n%it->fi){
			res=res+"+";
			if(ma.count(n%it->fi)) res=res+ma[n%it->fi];
			else res=res+to_string(n%it->fi);
		}
		if(ans.size()>res.size()) ans=res;
	}
	cout<<ans;
    return 0;
}


#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define pc putchar
#define ite map<int,string>::iterator
#define fi first
#define se second
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
using namespace std;
int n;
map<int,string> ma;
string ans;
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-1;ch=getchar();}
    while(isdigit(ch)){ret=ret*10+(ch^48);ch=getchar();}
    return ret*ff;
}
void write(int x){if(x<0){x=-x,pc('-');}if(x>9) write(x/10);pc(x%10+48);}
void writeln(int x){write(x),hh;}
void writesp(int x){write(x),pc(' ');}
signed main(){
	n=read();
	ans=to_string(n);
	int sq=sqrt(n);
	for(int a=2;a<=sq;a++){
		int x=1,now=a;
		while(now*a<=n){
			x++;
			now*=a;
			string t=to_string(a)+"^"+to_string(x);
			if(!ma.count(now)) ma[now]=t;
			else if(ma[now].size()>t.size()) ma[now]=t;
		}
	}
	for(ite it=ma.begin();it!=ma.end();it++){
		string res=it->se;
		if(n/it->fi>1){
			res=res+"*";
			string tt="";
			tt=to_string(n/it->fi);
			if(ma.count(n/it->fi)&&ma[n/it->fi].size()<tt.size()) tt=ma[n/it->fi];
			res=res+tt;
		}
		if(n%it->fi){
			res=res+"+";
			string tt="";
			tt=to_string(n%it->fi);
			if(ma.count(n%it->fi)&&ma[n%it->fi].size()<tt.size()) tt=ma[n%it->fi];
			res=res+tt;
		}
		if(ans.size()>res.size()) ans=res;
	}
	cout<<ans;
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;

string toString(ll n) {
    char a[20];
    int cnt = 0;
    while (n) {
        a[cnt++] = (n % 10) + '0';
        n /= 10;
    }
    a[cnt] = 0;
    reverse(a, a + cnt);
    return a;
}

ll N;
string ans;
map<ll, string> m;
vector<set<ll>> s(20);
vector<ll> p10;

void relaxAns(string r) {
    if (r.length() < ans.length()) {
        ans = r;
    }
}

string get(ll n) {
    if (m.count(n)) {
        return m[n];
    }
    return toString(n);
}
void relaxN(ll n, string r) {
    if (n > N || r.length() > 9) {
        return;
    }
    string old = get(n);
    if (old.length() <= r.length()) {
        return;
    }
    s[old.length()].erase(n);
    m[n] = r;
    s[r.length()].insert(n);
}
void preP10() {
    for (ll i = 0, cur = 1; i < 15; ++i, cur *= 10) {
        p10.push_back(cur);
    }
}
void prePower() {
    for (ll i = 2; i * i <= N; ++i) {
        int c = 2;
        ll cur = i * i;
        while (cur <= N) {
            relaxN(cur, toString(i) + '^' + toString(c));
            cur *= i;
            ++c;
        }
    }
}
void prePowerMulNumber(int maxlen) {
    for (int i = 1; i + 2 <= maxlen; ++i) {
        for (int j = 1; j < p10[maxlen - 1 - i]; ++j) {
            for (auto it : s[i]) {
                relaxN(it * j, get(it) + '*' + toString(j));
            }
        }
    }
}
void prePowerMulPower(int maxlen) {
    for (int i = 1; 2 * i + 1 <= maxlen; ++i) {
        for (int j = 1; j <= maxlen - 1 - i; ++j) {
            for (auto ni : s[i]) {
                for (auto nj : s[j]) {
                    relaxN(ni * nj, get(ni) + '*' + get(nj));
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    preP10();
    prePower();
    prePowerMulPower(7);
    prePowerMulNumber(7);

    ans = get(N);
    for (int i = 1; i * 2 + 1 <= ans.length() - 1; ++i) {
        for (auto ni : s[i]) {
            ll d = N - ni;
            if (d > 0) {
                relaxAns(get(ni) + '+' + get(d));
            }
            if (N % ni == 0) {
                relaxAns(get(ni) + '*' + get(N / ni));
            }
        }
        for (int j = 1; j < p10[i]; ++j) {
            ll d = N - j;
            if (d > 0) {
                relaxAns(toString(j) + '+' + get(d));
            }
            if (N % j == 0) {
                relaxAns(toString(j) + '*' + get(N / j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;

string toString(ll n) {
    char a[20];
    int cnt = 0;
    while (n) {
        a[cnt++] = (n % 10) + '0';
        n /= 10;
    }
    a[cnt] = 0;
    reverse(a, a + cnt);
    return a;
}

ll N;
string ans;
map<ll, string> m;
vector<set<ll>> s(20);
vector<ll> p10;

void relaxAns(string r) {
    if (r.length() < ans.length()) {
        ans = r;
    }
}

string get(ll n) {
    if (m.count(n)) {
        return m[n];
    }
    return toString(n);
}
void relaxN(ll n, string r) {
    if (n > N || r.length() > 9) {
        return;
    }
    string old = get(n);
    if (old.length() <= r.length()) {
        return;
    }
    s[old.length()].erase(n);
    m[n] = r;
    s[r.length()].insert(n);
}
void preP10() {
    for (ll i = 0, cur = 1; i < 15; ++i, cur *= 10) {
        p10.push_back(cur);
    }
}
void prePower() {
    for (ll i = 2; i * i <= N; ++i) {
        int c = 2;
        ll cur = i * i;
        while (cur <= N) {
            relaxN(cur, toString(i) + '^' + toString(c));
            cur *= i;
            ++c;
        }
    }
}
void prePowerMulNumber(int maxlen) {
    for (int i = 1; i + 2 <= maxlen; ++i) {
        for (int j = 1; j < p10[maxlen - 1 - i]; ++j) {
            for (auto it : s[i]) {
                relaxN(it * j, get(it) + '*' + toString(j));
            }
        }
    }
}
void prePowerMulPower(int maxlen) {
    for (int i = 1; 2 * i + 1 <= maxlen; ++i) {
        for (int j = 1; j <= maxlen - 1 - i; ++j) {
            for (auto ni : s[i]) {
                for (auto nj : s[j]) {
                    relaxN(ni * nj, get(ni) + '*' + get(nj));
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    preP10();
    prePower();
    prePowerMulPower(7);
    prePowerMulNumber(7);

    ans = get(N);
    for (int i = 1; i * 2 + 1 <= ans.length() - 1; ++i) {
        for (auto ni : s[i]) {
            ll d = N - ni;
            if (d > 0) {
                relaxAns(get(ni) + '+' + get(d));
            }
            if (N % ni == 0) {
                relaxAns(get(ni) + '*' + get(N / ni));
            }
        }
        for (int j = 1; j < p10[ans.length() - 1 - 1 - i]; ++j) {
            ll d = N - j;
            if (d > 0) {
                relaxAns(toString(j) + '+' + get(d));
            }
            if (N % j == 0) {
                relaxAns(toString(j) + '*' + get(N / j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

typedef long long ll;

string toString(ll n) {
    char a[20];
    int cnt = 0;
    while (n) {
        a[cnt++] = (n % 10) + '0';
        n /= 10;
    }
    a[cnt] = 0;
    reverse(a, a + cnt);
    return a;
}

ll N;
string ans;
map<ll, string> m;
vector<set<ll>> s(20);
vector<ll> p10;

void relaxAns(string r) {
    if (r.length() < ans.length()) {
        ans = r;
    }
}

string get(ll n) {
    if (m.count(n)) {
        return m[n];
    }
    return toString(n);
}
void relaxN(ll n, string r) {
    if (n > N || r.length() > 9) {
        return;
    }
    string old = get(n);
    if (old.length() <= r.length()) {
        return;
    }
    s[old.length()].erase(n);
    m[n] = r;
    s[r.length()].insert(n);
}
void preP10() {
    for (ll i = 0, cur = 1; i < 15; ++i, cur *= 10) {
        p10.push_back(cur);
    }
}
void prePower() {
    for (ll i = 2; i * i <= N; ++i) {
        int c = 2;
        ll cur = i * i;
        while (cur <= N) {
            relaxN(cur, toString(i) + '^' + toString(c));
            cur *= i;
            ++c;
        }
    }
}
void prePowerMulNumber(int maxlen) {
    for (int i = 1; i + 2 <= maxlen; ++i) {
        for (int j = 1; j < p10[maxlen - 1 - i]; ++j) {
            for (auto it : s[i]) {
                relaxN(it * j, get(it) + '*' + toString(j));
            }
        }
    }
}
void prePowerMulPower(int maxlen) {
    for (int i = 1; 2 * i + 1 <= maxlen; ++i) {
        for (int j = 1; j <= maxlen - 1 - i; ++j) {
            for (auto ni : s[i]) {
                for (auto nj : s[j]) {
                    relaxN(ni * nj, get(ni) + '*' + get(nj));
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    preP10();
    prePower();
    prePowerMulPower(7);
    prePowerMulNumber(7);

    ans = get(N);
    for (int i = 1; i * 2 + 1 <= ans.length() - 1; ++i) {
        for (auto ni : s[i]) {
            ll d = N - ni;
            if (d > 0) {
                relaxAns(get(ni) + '+' + get(d));
            }
            if (N % ni == 0) {
                relaxAns(get(ni) + '*' + get(N / ni));
            }
        }
        for (int j = 1; j < p10[ans.length() - 1 - 1 - i]; ++j) {
            int d = N - j;
            if (d > 0) {
                relaxAns(toString(j) + '+' + get(d));
            }
            if (N % j == 0) {
                relaxAns(toString(j) + '*' + get(N / j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;

string toString(ll n) {
    char a[20];
    int cnt = 0;
    while (n) {
        a[cnt++] = (n % 10) + '0';
        n /= 10;
    }
    a[cnt] = 0;
    reverse(a, a + cnt);
    return a;
}

ll N;
string ans;
map<ll, string> m;
vector<set<ll>> s(20);
vector<ll> p10;

void relaxAns(string r) {
    if (r.length() < ans.length()) {
        ans = r;
    }
}

string get(ll n) {
    if (m.count(n)) {
        return m[n];
    }
    return toString(n);
}
void relaxN(ll n, string r) {
    if (n > N || r.length() > 9) {
        return;
    }
    string old = get(n);
    if (old.length() <= r.length()) {
        return;
    }
    s[old.length()].erase(n);
    m[n] = r;
    s[r.length()].insert(n);
}
void preP10() {
    for (ll i = 0, cur = 1; i < 15; ++i, cur *= 10) {
        p10.push_back(cur);
    }
}
void prePower() {
    for (ll i = 2; i * i <= N; ++i) {
        int c = 2;
        ll cur = i * i;
        while (cur <= N) {
            relaxN(cur, toString(i) + '^' + toString(c));
            cur *= i;
            ++c;
        }
    }
}
void prePowerMulNumber(int maxlen) {
    for (int i = 1; i + 2 <= maxlen; ++i) {
        for (int j = 1; j < p10[maxlen - 1 - i]; ++j) {
            for (auto it : s[i]) {
                relaxN(it * j, get(it) + '*' + toString(j));
            }
        }
    }
}
void prePowerMulPower(int maxlen) {
    for (int i = 1; 2 * i + 1 <= maxlen; ++i) {
        for (int j = 1; j <= maxlen - 1 - i; ++j) {
            for (auto ni : s[i]) {
                for (auto nj : s[j]) {
                    relaxN(ni * nj, get(ni) + '*' + get(nj));
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    preP10();
    prePower();
    prePowerMulPower(7);
    prePowerMulNumber(7);

    ans = get(N);
    cout << N << " " << ans << endl;
    for (int i = 1; i * 2 + 1 <= ans.length() - 1; ++i) {
        for (auto ni : s[i]) {
            ll d = N - ni;
            if (d > 0) {
                relaxAns(get(ni) + '+' + get(d));
            }
            if (N % ni == 0) {
                relaxAns(get(ni) + '*' + get(N / ni));
            }
        }
        for (int j = 1; j < p10[ans.length() - 1 - 1 - i]; ++j) {
            ll d = N - j;
            if (d > 0) {
                relaxAns(toString(j) + '+' + get(d));
            }
            if (N % j == 0) {
                relaxAns(toString(j) + '*' + get(N / j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;

string toString(ll n) {
    char a[20];
    int cnt = 0;
    while (n) {
        a[cnt++] = (n % 10) + '0';
        n /= 10;
    }
    a[cnt] = 0;
    reverse(a, a + cnt);
    return a;
}

ll N;
string ans;
map<ll, string> m;
vector<set<ll>> s(20);
vector<ll> p10;

void relaxAns(string r) {
    if (r.length() < ans.length()) {
        ans = r;
    }
}

string get(ll n) {
    if (m.count(n)) {
        return m[n];
    }
    return toString(n);
}
void relaxN(ll n, string r) {
    if (n > N || r.length() > 9) {
        return;
    }
    string old = get(n);
    if (old.length() <= r.length()) {
        return;
    }
    s[old.length()].erase(n);
    m[n] = r;
    s[r.length()].insert(n);
}
void preP10() {
    for (ll i = 0, cur = 1; i < 15; ++i, cur *= 10) {
        p10.push_back(cur);
    }
}
void prePower() {
    for (ll i = 2; i * i <= N; ++i) {
        int c = 2;
        ll cur = i * i;
        while (cur <= N) {
            relaxN(cur, toString(i) + '^' + toString(c));
            cur *= i;
            ++c;
        }
    }
}
void prePowerMulNumber(int maxlen) {
    for (int i = 1; i + 2 <= maxlen; ++i) {
        for (int j = 1; j < p10[maxlen - 1 - i]; ++j) {
            for (auto it : s[i]) {
                relaxN(it * j, get(it) + '*' + toString(j));
            }
        }
    }
}
void prePowerMulPower(int maxlen) {
    for (int i = 1; 2 * i + 1 <= maxlen; ++i) {
        for (int j = 1; j <= maxlen - 1 - i; ++j) {
            for (auto ni : s[i]) {
                for (auto nj : s[j]) {
                    relaxN(ni * nj, get(ni) + '*' + get(nj));
                }
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    preP10();
    prePower();
    prePowerMulPower(7);
    prePowerMulNumber(7);

    ans = get(N);
    for (int i = 1; i * 2 + 1 <= ans.length() - 1; ++i) {
        for (auto ni : s[i]) {
            ll d = N - ni;
            if (d > 0) {
                relaxAns(get(ni) + '+' + get(d));
            }
            if (N % ni == 0) {
                relaxAns(get(ni) + '*' + get(N / ni));
            }
        }
        for (int j = 1; j < p10[ans.length() - 1 - 1 - i]; ++j) {
            int d = N - j;
            if (d > 0) {
                relaxAns(toString(j) + '+' + get(d));
            }
            if (N % j == 0) {
                relaxAns(toString(j) + '*' + get(N / j));
            }
        }
    }

    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	//if(x=="56")cout<<"**************"<<" "<<last<<" "<<ind<<" "<<vis<<endl;
	int tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)continue;
		string hlp="";
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		else hlp=dp[n-tmp];
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp="";
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		else hlp=dp2[n/tmp];
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<10){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans+='+';
				ans+=char(res+'0');
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	//if(x=="56")cout<<"**************"<<" "<<last<<" "<<ind<<" "<<vis<<endl;
	int tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)continue;
		string hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		int now=i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	//if(x=="1*")cout<<"**************"<<" "<<last<<" "<<ind<<endl;
	int tmp=check(0,(int)x.size()-1);
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis || !dp2[tmp].size() || dp2[tmp].size()>x.size()))dp2[tmp]=x;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
	//	if(ch[i].F=="1")cout<<tmp<<endl;
		//if(ch[i].F=="1*")cout<<"**********"<<ch[i].S<<endl;
		if(tmp>n)continue;
		string hlp="";
	//	if(tmp==1000*1000*1000)cout<<ch[i].F<<"**********"<<" "<<dp[n-tmp]<<endl;
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		else hlp=dp[n-tmp];
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp="";
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		else hlp=dp2[n/tmp];
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	//if(x=="56")cout<<"**************"<<" "<<last<<" "<<ind<<" "<<vis<<endl;
	int tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)continue;
		string hlp="";
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		else hlp=dp[n-tmp];
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp="";
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		else hlp=dp2[n/tmp];
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<100){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans=mrg(ans,'+',f(res));
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<10){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans+='+';
				ans+=char(res+'0');
			}
		}
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		if(now%i!=0)continue;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<100){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans+='+';
				ans=mrg(ans,'+',f(res));
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	int tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)break;
		string hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		int now=i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<10){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans+='+';
				ans+=char(res+'0');
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)continue;
		string hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		if(now%i!=0)continue;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<100){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans=mrg(ans,'+',f(res));
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n){
			now/=i;
			int res=n-now;
			//cout<<i<<" "<<res<<" "<<cnt<<endl;
			if(res>0 && res<100)
			{
				//cout<<i<<" "<<res<<" "<<cnt<<endl;
				string hlp=f(res);
				string t=mrg(tmp,'^',f(cnt));
				if(t.size()+hlp.size()+1<ans.size())ans=mrg(t,'+',hlp);
			}
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=(1<<20)+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<int,string>dp,dp2;
string x;
vector<pair<string,int> >ch;
bool flag=0;
int check(int l,int r)
{
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')return check(l,i-1)+check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='*')return check(l,i-1)*check(i+1,r);
	}
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='^')
		{
			int tmp=check(l,i-1);
			int tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			int now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
		}
	}
	int t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(int tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	int tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(ind==6)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	int n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		int tmp=ch[i].S;
		//if(ch[i].F=="9^8")cout<<ch[i].S<<" "<<n/tmp<<" "<<f(n/tmp)<<" "<<bad(ch[i].F)<<endl;
		if(tmp>n)break;
		string hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		//if(tmp==1)cout<<hlp<<"*************"<<endl;
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		//if(tmp==1)cout<<dp2[n/tmp]<<endl;
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		//if(tmp==1)cout<<hlp<<"********"<<end
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		int now=i,cnt=0;
		if(now%i!=0)continue;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,mod2=1e9+9,inf=1e9+30;
map<ll,string>dp,dp2;
string x;
vector<pair<string,ll> >ch;
bool flag=0;
ll check(int l,int r)
{
	int ind[3];
	ind[1]=-1,ind[2]=-1,ind[3]=-1;
	for(int i=l;i<=r;i++)
	{
		if(x[i]=='+')
		{
			ind[1]=i;
		}
		if(x[i]=='*')ind[2]=i;
		if(x[i]=='^')ind[3]=i;
	}
	if(ind[1]!=-1)return check(l,ind[1]-1)+check(ind[1]+1,r);
	if(ind[2]!=-1)return check(l,ind[2]-1)*check(ind[2]+1,r);
	if(ind[3]!=-1)
	{
			int i=ind[3];
			ll tmp=check(l,i-1);
			ll tmp2=check(i+1,r);
			if(tmp==1)
				return 1;
			ll now=1;
			for(int j=1;j<=tmp2;j++)
			{
				if(1e10/now<tmp)
				{
					flag=1;
					return 0;
				}
				now*=tmp;
			}
			return now;
	}
	ll t=0;
	for(int i=l;i<=r;i++)t*=10,t+=x[i]-'0';
	return t;
}
bool bad(string x)
{
	for(int i=0;i<x.size();i++)
	{
		if(x[i]=='+')return 1;
	}
	return 0;
}
string f(ll tmp)
{
	string now="";
	while(tmp!=0)now+=char((tmp%10)+'0'),tmp/=10;
	reverse(now.begin(),now.end());
	return now;
}
void bt(int ind,bool last,bool vis)
{
	flag=0;
	ll tmp;
	if(!last)
		 tmp=check(0,(int)x.size()-1);
	//if(x=="56")cout<<tmp<<endl;
	//cout<<tmp<<endl;
	if(!last && !flag && (dp[tmp].size()==0 || dp[tmp].size()>x.size()))dp[tmp]=x,ch.pb(mp(x,tmp));
	if(!last && !flag && (!vis && (!dp2[tmp].size() || dp2[tmp].size()>x.size())))dp2[tmp]=x;
	if(flag)return;
	if(ind==5)
	{
		return;
	}
	string tm=x;
	for(int i=0;i<=9;i++)
	{
		if(last && i==0)continue;
		x+=char(i+'0');
		bt(ind+1,0,vis);
		x=tm;
	}
	if(last)return;
	x+='+';
	bt(ind+1,1,1);
	x=tm;
	x+='^';
	bt(ind+1,1,vis);
	x=tm;
	x+='*';
	bt(ind+1,1,vis);
	x=tm;
}
string mrg(string x,char tmp,string y)
{
	x+=tmp;
	for(int i=0;i<y.size();i++)x+=y[i];
	//if(x=="1*")cout<<x.size()<<" "<<y.size()<<endl;
	return x;
}
int32_t main()
{
	ll n;
	cin>>n;
	bt(0,1,0);
	//x="10^9+7";
	//cout<<check(0,(int)x.size()-1)<<endl;
	string ans=f(n);
	if(dp[n].size())ans=dp[n];
	//cout<<dp2[56]<<endl;
	//cout<<ans<<endl;
	//cout<<dp[1000*1000*1000]<<endl;
	for(int i=0;i<ch.size();i++)
	{
		ll tmp=ch[i].S;
		ll res=n-tmp*(n/tmp);
		string hlp;
		if(res && res<100){
			string hlp=f(n/tmp);
			if(dp2[n/tmp].size()!=0)hlp=dp2[n/tmp];
			if(hlp.size()+ch[i].F.size()+2<ans.size()){ans=mrg(ch[i].F,'*',hlp);
				ans=mrg(ans,'+',f(res));
			}
		}
		if(tmp>n)continue;
		hlp=dp[n-tmp];
		if(dp[n-tmp].size()==0)hlp=f(n-tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'+',hlp);
		if(bad(ch[i].F) || n%tmp!=0)continue;
		hlp=dp2[n/tmp];
		if(dp2[n/tmp].size()==0)hlp=f(n/tmp);
		if((int)hlp.size()+(int)ch[i].F.size()+1<ans.size())ans=mrg(ch[i].F,'*',hlp);

	}
	for(int i=2;i<=1e5;i++)
	{
		string tmp=f(i);
		ll now=(ll)i,cnt=0;
		while(now<n){
			now*=i;
			cnt++;
		}
		if(now!=n){
			now/=i;
			int res=n-now;
			if(res<100)
			{
				string hlp=f(res);
				string t=mrg(tmp,'^',f(cnt));
				if(t.size()+hlp.size()+1<ans.size())ans=mrg(t,'+',hlp);
			}
		}
		if(now!=n)continue;
		string tm=f(cnt+1);
		if(tm.size()+tmp.size()+1<ans.size())ans=mrg(tmp,'^',tm);
	}
	cout<<ans;
}