#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n,total; scanf("%d%d",&n,&total); vector a(n); rep(i,n) scanf("%d",&a[i]); static char dp[50][100001]; rep(i,n) rep(x,total+1) dp[i][x]='x'; dp[0][a[0]]='o'; rep(i,n-1){ rep(x,total+1) if(dp[i][x]!='x') if(x*a[i+1]<=total) dp[i+1][x*a[i+1]]='*'; rep(x,total+1) if(dp[i][x]!='x') if(x+a[i+1]<=total) dp[i+1][x+a[i+1]]='+'; } string ans; int res=total; for(int i=n-1;i>0;i--){ char c=dp[i][res]; ans+=c; if(c=='+') res-=a[i]; else res/=a[i]; } reverse(ans.begin(),ans.end()); puts(ans.c_str()); return 0; }