Vasya is a regular participant at programming contests and is already experienced in finding important sentences in long statements. Of course, numbers constraints are important — factorization of a number less than 1000000 is easier than of a number less than 1000000000. However, sometimes it's hard to understand the number at the first glance. Could it be shortened? For example, instead of 1000000 you could write 10^{6}, instead of 1000000000 —10^{9}, instead of 1000000007 — 10^{9}+7.

Vasya decided that, to be concise, the notation should follow several rules: 

  * the notation should only consist of numbers, operations of addition ("+"), multiplication ("*") and exponentiation ("^"), in particular, the use of braces is forbidden; 
  * the use of several exponentiation operations in a row is forbidden, for example, writing "2^3^4" is unacceptable; 
  * the value of the resulting expression equals to the initial number; 
  * the notation should consist of the minimal amount of symbols. 



Given n, find the equivalent concise notation for it.

Input

The only line contains a single integer n (1 ≤ n ≤ 10 000 000 000).

Output

Output a concise notation of the number n. If there are several concise notations, output any of them.

Examples

Input

2018


Output

2018


Input

1000000007


Output

10^9+7


Input

10000000000


Output

100^5


Input

2000000000


Output

2*10^9

Note

The third sample allows the answer 10^10 also of the length 5.
#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &u) {
  u = 0;
  char c = getchar();
  long long flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    u = (u << 3) + (u << 1) + (c ^ 48), c = getchar();
  if (flag) u = -u;
}
template <class T>
bool checkmin(T &a, T b) {
  return (b < a ? a = b, 1 : 0);
}
template <class T>
bool checkmax(T &a, T b) {
  return (b > a ? a = b, 1 : 0);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T _max(T a, T b) {
  return (a > b ? a : b);
}
const long long lim = 10000000000;
long long n;
string ans = "";
string get_str(long long x) {
  string t = "";
  while (x) {
    t += ('0' + x % 10);
    x /= 10;
  }
  reverse(t.begin(), t.end());
  return t;
}
long long num(long long x) {
  long long tmp = 0;
  while (x) {
    ++tmp;
    x /= 10;
  }
  return tmp;
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
vector<pair<pair<long long, long long>, pair<long long, long long> > > v, w;
void init() {
  cin >> n;
  ans = get_str(n);
  for (long long i = 2; i <= 33; ++i) {
    long long R = (long long)pow(lim + lim, 1.0 / i);
    for (long long j = 2; j <= R; ++j) {
      long long p = num(j) + 1 + num(i);
      long long x = qpow(j, i);
      if (x > lim) break;
      v.push_back(make_pair(make_pair(x, p), make_pair(j, i)));
    }
  }
  sort(v.begin(), v.end());
  for (long long i = 0; i < (long long)v.size(); ++i) {
    if (i != 0 && v[i].first.first == v[i - 1].first.first) {
      continue;
    }
    w.push_back(v[i]);
  }
  for (long long i = 0; i < (long long)w.size(); ++i) {
    if (w[i].first.first == n) {
      if (w[i].first.second < ans.size()) {
        ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second);
      }
    }
    if (w[i].first.first < n) {
      long long x = n - w[i].first.first;
      if (w[i].first.second + 1 + num(x) < ans.size()) {
        ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
              "+" + get_str(x);
      }
      pair<pair<long long, long long>, pair<long long, long long> > tmp =
          *lower_bound(w.begin(), w.end(),
                       make_pair(make_pair(x, 0LL), make_pair(0LL, 0LL)));
      if (tmp.first.first == x) {
        if (w[i].first.second + 1 + tmp.first.second < ans.size()) {
          ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
                "+" + get_str(tmp.second.first) + "^" +
                get_str(tmp.second.second);
        }
      }
    }
    if (n % w[i].first.first == 0) {
      long long x = n / w[i].first.first;
      if (w[i].first.second + 1 + num(x) < ans.size()) {
        ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
              "*" + get_str(x);
      }
      pair<pair<long long, long long>, pair<long long, long long> > tmp =
          *lower_bound(w.begin(), w.end(),
                       make_pair(make_pair(x, 0LL), make_pair(0LL, 0LL)));
      if (tmp.first.first == x) {
        if (w[i].first.second + 1 + tmp.first.second < ans.size()) {
          ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
                "*" + get_str(tmp.second.first) + "^" +
                get_str(tmp.second.second);
        }
      }
    }
    if (w[i].first.first < n) {
      long long big = n / w[i].first.first, now = 9;
      long long res = n % w[i].first.first;
      if (w[i].first.second + 1 + num(big) + 1 + num(res) < ans.size()) {
        ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
              "*" + get_str(big) + "+" + get_str(res);
      }
      while (now <= big) {
        res = n - now * w[i].first.first;
        if (w[i].first.second + 1 + num(now) + 1 + num(res) < ans.size()) {
          ans = get_str(w[i].second.first) + "^" + get_str(w[i].second.second) +
                "*" + get_str(now) + "+" + get_str(res);
        }
        now = now * 10 + 9;
      }
    }
  }
}
long long P[13][13];
void solve() {
  if (ans.size() <= 9) {
    cout << ans << endl;
    return;
  }
  for (long long a = 0; a <= 9; ++a) {
    for (long long b = 0; b <= 9; ++b) {
      P[a][b] = qpow(a, b);
    }
  }
  for (long long a = 0; a <= 9; ++a) {
    for (long long b = 0; b <= 9; ++b) {
      for (long long c = 0; c <= 9; ++c) {
        for (long long d = 0; d <= 9; ++d) {
          for (long long e = 0; e <= 9; ++e) {
            if (P[a][b] + P[c][d] + e == n) {
              cout << get_str(a) << "^" << get_str(b) << "+" << get_str(c)
                   << "^" << get_str(d) << "+" << get_str(e) << endl;
              return;
            }
            if (P[a][b] * c + P[d][e] == n) {
              cout << get_str(a) << "^" << get_str(b) << "*" << get_str(c)
                   << "+" << get_str(d) << "^" << get_str(e) << endl;
              return;
            }
            if (P[a][b] * P[c][d] * e == n) {
              cout << get_str(a) << "^" << get_str(b) << "*" << get_str(c)
                   << "^" << get_str(d) << "*" << get_str(e) << endl;
              return;
            }
            if (P[a][b] * P[c][d] + e == n) {
              cout << get_str(a) << "^" << get_str(b) << "*" << get_str(c)
                   << "^" << get_str(d) << "+" << get_str(e) << endl;
              return;
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}
