#include using namespace std; /////////////////// メイン /////////////////// int main () { //////////////////// 入力 //////////////////// int n, t; cin >> n >> t; vector a(n); for (int i=0; i> a.at(i); } //////////////// 出力変数定義 //////////////// string result = ""; //////////////////// 処理 //////////////////// set> s; for (int num : a) { if (s.empty()) { s.emplace("",num); continue; } set> next; set check; for (auto [str,i] : s) { if (check.find(i+num)==check.end()&&i+num<=t) { check.emplace(i+num); next.emplace(str+'a',i+num); } if (check.find(i*num)==check.end()&&i*num<=t) { check.emplace(i*num); next.emplace(str+'b',i*num); } } swap(s,next); } for (auto [str,i] : s) { if (i==t) { for (char c : str) { if (c=='a') result += '+'; else if (c=='b') result += '*'; } break; } } //////////////////// 出力 //////////////////// cout << result << endl; //////////////////// 終了 //////////////////// return 0; }