func_code_string: #include <bits/stdc++.h>   #define jh(x, y) (x ^= y ^= x ^= y)   #define loc(x, y) ((x - 1) * m + y)   #define lowbit(x) (x & -x)   typedef long long ll;   const int N = 5e5 + 5, INF = 0x3f3f3f3f, mod = 1e9 + 7;   const double PI = acos(-1), EPS = 1e-7;   using namespace std;   namespace fast_IO {    ll read() {     ll x = 0;     char c;     bool flag = false;     while ((c = getchar()) ==     || c ==   n  || c ==   r );     if (c ==  - )flag = true; else x = c ^ 48;     while ((c = getchar()) !=     && c !=   n  && c !=   r  && ~c)      x = (x << 1) + (x << 3) + (c ^ 48);     if (flag)return -x;     return x;    }    void write(ll x) {     if (x < 0)putchar( - ), x = -x;     if (x >= 10)write(x / 10);     putchar(x % 10 ^ 48);    }   }   char s[4];   bool tag[N];   int a[N], b[N], pre[N];   ll dp[N];   void print(int l, int r, int st, int m) {    if (l >= st) {     print(pre[l], l, st, m);     putchar( + );    }    printf( %d , b[l + 1]);    for (int i = l + 2; i <= r; ++i)     printf( *%d , b[i]);   }   void solve(int n) {    //既有*又有+    int m = n, st = 1;    while (m && b[m] == 1)--m;    while (st <= n && b[st] == 1)++st;    for (int i = 1; i < st; ++i) {     printf( 1 );     if (i != n)putchar( + );    }    if(st > n)return;    int sum = 1;    for (int i = st; i <= m; ++i)sum = min((m - st + 1) * 2, sum * b[i]);    if (sum == (m - st + 1) * 2) {     printf( %d , b[st]);     for (int i = st + 1; i <= m; ++i)      printf( *%d , b[i]);    }    else {     for (int i = st; i <= m; ++i)dp[i] = -1e17;     dp[st] = b[st]; pre[st] = st - 1;     dp[st - 1] = 0;     for (int i = st; i < m; ++i) {      if (b[i + 1] == 1)dp[i + 1] = dp[i] + 1, pre[i + 1] = i;      else {       ll mul = 1;       for (int j = i + 1; j >= st; --j) {        mul *= b[j];        if (dp[i + 1] < dp[j - 1] + mul) {         dp[i + 1] = dp[j - 1] + mul;         pre[i + 1] = j - 1;        }       }      }     }     print(pre[m], m, st, m);    }    for (int i = m + 1; i <= n; ++i)     printf( +1 );   }      int main() {    int n = fast_IO::read();    for (int i = 1; i <= n; ++i)a[i] = fast_IO::read();    scanf( %s , s);    for (int i = 0; s[i]; ++i)tag[s[i]] = true;    if (!s[1]) {     printf( %d , a[1]);     for (int i = 2; i <= n; ++i)      printf( %c%d , s[0], a[i]);    }    else if (!tag[ * ]) {     if (tag[ + ]) {      printf( %d , a[1]);      for (int i = 2; i <= n; ++i)       printf( +%d , a[i]);     }    }    else {     if (!tag[ + ]) {      printf( %d , a[1]);      for (int i = 2; i <= n; ++i) {       if (a[i] == 0) {        printf( -0 );        continue;       }       printf( *%d , a[i]);      }     }     else {      int now = 0;      for (int i = 1; i <= n; ++i) {       if (a[i] == 0) {        if (now)solve(now);        now = 0;        if (i != 1 && a[i - 1])putchar( + );        printf( 0 );        if (i != n)putchar( + );       }       else b[++now] = a[i];      }      if (now)solve(now);     }    }    return 0;   }   