#include #include using namespace std; int main(){ int n, total; cin >> n >> total; int a[n]; for(int i = 0; i < n; i++) cin >> a[i]; static bool d[50][100001] = {}; d[0][a[0]] = true; for(int i = 1; i < n; i++){ for(int j = 0; j < 100001; j++){ if(!d[i-1][j]) continue; if(j+a[i] < 100001) d[i][j+a[i]] = true; if(j*a[i] < 100001) d[i][j*a[i]] = true; } } string ret = ""; for(int i = n-1; i > 0; i--){ if(d[i-1][total - a[i]]) total -= a[i], ret += "+"; else if(d[i-1][total/a[i]]) total /= a[i], ret += "*"; } reverse(ret.begin(), ret.end()); cout << ret << endl; return 0; }