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;
void debug(int* a, int n) {
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << '\n';
}
void debug(vector<int> b, int n) {
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << '\n';
}
const long long INF = 1e18;
const int inf = 1e9;
map<long long, string> ss;
int main() {
  ios_base::sync_with_stdio(false);
  long long n, i, j, count;
  cin >> n;
  string ans = to_string(n);
  for (i = 2; i <= n; i++) {
    if (i * i > n) break;
    j = i;
    count = 1;
    while (j <= n) {
      string s1 = to_string(i) + '^' + to_string(count);
      long long l1 = n / j;
      long long l2 = n - (j * l1);
      string s2;
      if (ss.find(j) == ss.end()) {
        s2 = to_string(j);
        if (s2.length() > s1.length()) s2 = s1;
        ss[j] = s2;
      } else if (ss[j].length() > s1.length()) {
        ss[j] = s1;
      }
      if (j == n) {
        if (s1.length() < ans.length()) ans = s1;
      } else if (l2 == 0) {
        s2 = s1;
        s1 = s1 + '*' + to_string(l1);
        if (s1.length() < ans.length()) ans = s1;
        if (ss.find(l1) != ss.end()) {
          s2 = s2 + '*' + ss[l1];
          if (s2.length() < ans.length()) ans = s2;
        }
      } else if (l1 == 1) {
        s2 = s1;
        s1 = s1 + '+' + to_string(l2);
        if (s1.length() < ans.length()) ans = s1;
        if (ss.find(l2) != ss.end()) {
          s2 = s2 + '+' + ss[l2];
          if (s2.length() < ans.length()) ans = s2;
        }
      } else {
        string s11 = s1 + '*' + to_string(l1) + '+' + to_string(l2);
        if (s11.length() < ans.length()) ans = s11;
        if (ss.find(l2) != ss.end()) {
          s11 = s1 + '*' + to_string(l1) + '+' + ss[l2];
          if (s11.length() < ans.length()) ans = s11;
        }
        if (ss.find(l1) != ss.end()) {
          s11 = s1 + '*' + ss[l1] + '+' + to_string(l2);
          if (s11.length() < ans.length()) ans = s11;
        }
        if (ss.find(l1) != ss.end() && ss.find(l2) != ss.end()) {
          s11 = s1 + '*' + ss[l1] + '+' + ss[l2];
          if (s11.length() < ans.length()) ans = s11;
        }
      }
      long long tt = n - j;
      if (ss.find(tt) != ss.end()) {
        s1 = s1 + '+' + ss[tt];
        if (s1.length() < ans.length()) ans = s1;
      }
      j = j * i;
      count++;
    }
  }
  cout << ans << endl;
  return 0;
}
