// yukicoder: 10 +か×か // 2021.8.13 #include typedef long long ll; #define gc() getchar_unlocked() #define pc(c) putchar_unlocked(c) int in() { // 非負整数の入力 int n = 0, c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } ll dp[55][100005][3]; // [0]:exist, [1]:+or*, [2]:prev void chmin(int *a, int b) { if (*a > b) *a = b; } int max(int a, int b) { return a >= b? a: b; } void mypr(int i, int j) { if (i == 0) return; mypr(i-1, dp[i][j][2]); pc((dp[i][j][1] & 1)? '*': '+'); } int main() { int i, j, t, ma, A; int N = in(), total = in(); A = in(); dp[0][A][0] = 1, ma = A; for (i = 1; i < N; ++i) { A = in(); for (j = ma; j >= 0; --j) if (dp[i-1][j][0]) { t = j*A; if (t <= total && (!dp[i][t][0] || dp[i][t][1] > ((dp[i-1][j][1]<<1)|1))) { dp[i][t][0] = 1, dp[i][t][1] = (dp[i-1][j][1]<<1)|1; dp[i][t][2] = j; } t = j+A; if (t <= total && (!dp[i][t][0] || dp[i][t][1] > (dp[i-1][j][1]<<1))) { dp[i][t][0] = 1, dp[i][t][1] = dp[i-1][j][1]<<1; dp[i][t][2] = j; } } ma = max(ma*A, ma+A), chmin(&ma, total); } mypr(N-1, total); pc('\n'); return 0; }