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>
const long long N = 200005, mod = 1000000007;
using namespace std;
long long n, m, i, j, k = 1, l, r, t, a, b, c;
string ans, s, s1, s3, s2;
string shafaq(long long n) {
  string s = "";
  while (n) {
    s += (char)(n % 10 + 48);
    n /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
string tupac(long long n, long long qq = 101, bool bb = false) {
  long long i, j, m, k, kk, mm;
  string ans = shafaq(n), s, ss;
  for (i = 2; i < qq; i++) {
    if (n % (i * i)) continue;
    m = n;
    k = 0;
    while (m % i == 0) {
      if (!m) break;
      m /= i;
      k++;
    }
    if (m == 1) {
      s = shafaq(i) + '^' + shafaq(k);
      if (s.size() < ans.size()) ans = s;
    } else {
      s = shafaq(i) + '^' + shafaq(k) + '*' + shafaq(m);
      if (s.size() < ans.size()) ans = s;
    }
    s = shafaq(i) + '^' + shafaq(k) + '*';
    m = n / (i * i);
    if (bb) continue;
    for (j = i + 1; j < qq; j++) {
      if (m % (j * j)) continue;
      mm = m;
      kk = 0;
      while (mm % j == 0) {
        if (mm == 0) break;
        mm /= j;
        kk++;
      }
      if (mm == 1) {
        ss = s + shafaq(j) + '^' + shafaq(kk);
        if (ss.size() < ans.size()) ans = ss;
      } else {
        ss = s + shafaq(j) + '^' + shafaq(kk) + '*' + shafaq(mm);
        if (ss.size() < ans.size()) ans = ss;
      }
    }
  }
  return ans;
}
int main() {
  cin >> n;
  ans = shafaq(n);
  ans = tupac(n, 100003, 1);
  for (b = 2; b < 101; b++) {
    k = 1;
    for (i = 1;; i++) {
      k *= b;
      if ((n % k) != 0) {
        s3 = '+' + tupac(n % k);
      } else
        s3 = "";
      if (n / k != 1) {
        s1 = tupac(n / k) + '*';
      } else
        s1 = "";
      s = s1 + shafaq(b) + "^" + shafaq(i) + s3;
      if (ans.size() > s.size()) ans = s;
      s = s1 + shafaq(k) + s3;
      if (ans.size() > s.size()) ans = s;
      if (k > n) break;
    }
  }
  cout << ans << endl;
  return 0;
}
