using System; using System.Collections.Generic; using System.Linq; class Magatro { static int N; static int Total; static int[] A; const int MAX = 100000; static void Main() { Read(); string[,] ans = new string[N, MAX+1]; ans[1, A[0] * A[1]] = "*"; ans[1, A[0] + A[1]] = "+"; for (int j = 2; j < N; j++) { for (int i = 0; i <= MAX; i++) { if (ans[j-1, i] != null) { if (i * A[j] <= MAX) { ans[j, i * A[j]] = Min(ans[j - 1, i] + "*",ans[j,i*A[j]]); } if (i + A[j] <= MAX) { ans[j, i + A[j]] =Min( ans[j - 1, i] + "+", ans[j, i + A[j]]); } } } } Console.WriteLine(ans[N - 1, Total]); } static void Read() { N = int.Parse(Console.ReadLine()); Total = int.Parse(Console.ReadLine()); A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); } static string Min(string a,string b) { if (a == null) { return b; } if (b == null) { return a; } for(int i = 0; i < Math.Min(a.Length, b.Length); i++) { if (a[i] != b[i]) { if (a[i] == '+') { return a; } else { return b; } } } return "Dummy"; } }