using System; using System.Collections.Generic; using System.Linq; namespace No10_1{ public class Program{ public static int n = Read(Convert.ToInt32); public static int total = Read(Convert.ToInt32); public static List an = ReadList(Convert.ToInt32); public static Stack stk = new Stack(); public static void Main(string[] args){ an.Insert(0, 0); Solve(true, 0, 0); stk.Pop(); stk.Pop(); var result = ""; foreach(var s in stk){ result += s ? "+" : "*"; } Console.WriteLine(result); } public static bool Solve(bool op, int sum, int cnt){ if(sum == total && cnt == n + 1) return true; if(sum > total || cnt > n) return false; if(Solve(true, sum + an[cnt], cnt + 1)){ stk.Push(true); return true; } if(Solve(false, sum * an[cnt], cnt + 1)) { stk.Push(false); return true; } return false; } public static TOutput Read(Converter converter){ return converter(Console.ReadLine()); } public static List ReadList(Converter converter, char c = ' '){ return Console.ReadLine()?.Split(c).ToList().ConvertAll(converter); } } }