#include using namespace std; using Int32 = int_fast32_t; using Word32 = uint_fast32_t; using Int64 = int_fast64_t; using Word64 = uint_fast64_t; using Int128 = __int128_t; using Word128 = __uint128_t; using Int = int_fast64_t; using Word = uint_fast64_t; using F32 = float; using F64 = double; using F80 = long double; using VInt = vector; using VVI = vector; using VWord = vector; using VVW = vector; using VF32 = vector; using VF64 = vector; using VF80 = vector; using VS = vector; using VVS = vector; using VB = vector; using VVB = vector; using PII = pair; using PWW = pair; using VPII = vector; using VPWW = vector; using PQ_PII = priority_queue>; #define SZ(x) ((Int)(x).size()) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) #define rep(i,n) for(Int i=0, i##_len=(n); i> n; Int total; cin >> total; VInt a(n); rep(i,n) cin >> a[i]; string ans; VVB dp(n, VB(total + 1)); auto dfs = [&](auto dfs, Int i, Int res) { if (res > total) { return; } if (i == n && res == total) { cout << ans << '\n'; return; } if (dp[i][res]) { return; } dp[i][res] = true; ans += '+', dfs(dfs, i + 1, res + a[i]), ans.pop_back(); ans += '*', dfs(dfs, i + 1, res * a[i]), ans.pop_back(); }; dfs(dfs, 1, a[0]); return 0; }