#include int n; int total; int xs[64]; int lower[64]; char buf[64]; bool dfs(int i, int x) { // for(int j = 0; j < i; ++j) putchar(' '); // printf("(i, sum, x) = (%d, %d)\n", i, x); if( i == n ) return (x == total); do { if( x + lower[i+1] > total ) break; buf[i-1] = '+'; if( dfs(i + 1, x + xs[i]) ) return true; } while(false); do { if( x * lower[i+1] > total ) break; buf[i-1] = '*'; if( dfs(i + 1, x * xs[i]) ) return true; } while(false); return false; } int main() { scanf("%d", &n); scanf("%d", &total); for(int i = 0; i < n; ++i) { scanf("%d", &xs[i]); } // step 1 for(int i = 0; i < n; ++i) { int x = 0; for(int j = i; j < n; ++j) { if( xs[j] != 1 ) x += xs[j]; } lower[i] = x; } // step 2 dfs(1, xs[0]); // step 3 printf("%s\n", buf); return 0; }