#include #include #include #include int main() { using namespace std; int n, tot; cin >> n >> tot; vector a(n); for (auto &e : a) { cin >> e; } vector used(n, vector(tot + 1, false)); auto dfs = [&](auto dfs, int i, int x, string s) -> void { if (i == n) { if (x == tot) { cout << s << endl; exit(0); } return; } if (x + a[i] <= tot && !used[i][x + a[i]]) { used[i][x + a[i]] = true; dfs(dfs, i + 1, x + a[i], s + "+"); } if (x <= tot / a[i] && !used[i][x * a[i]]) { used[i][x * a[i]] = true; dfs(dfs, i + 1, x * a[i], s + "*"); } }; dfs(dfs, 1, a[0], ""); }