#include #define REP(i,n) for(int i=0; i<(int)(n); i++) #include #include inline int getInt(){ int s; scanf("%d", &s); return s; } #include using namespace std; int dp[51][100000]; int main(){ const int n = getInt(); const int t = getInt(); vector a(n); REP(i,n) a[i] = getInt(); dp[n][t] = 1; for(int i = n - 1; i >= 0; i--){ REP(j,t+1) if(dp[i + 1][j]){ if(j - a[i] >= 0) dp[i][j - a[i]] = 1; if(j % a[i] == 0) dp[i][j / a[i]] = 1; } } string ans(n - 1, '*'); int cur = a[0]; REP(i,n-1){ if(dp[i + 2][cur + a[i + 1]]){ cur += a[i + 1]; ans[i] = '+'; }else{ cur *= a[i + 1]; ans[i] = '*'; } } puts(ans.c_str()); return 0; }