import std.stdio; import std.array; import std.string; import std.conv; import std.algorithm; import std.typecons; import std.range; import std.random; import std.math; import std.container; void main() { auto N = readln.chomp.to!int; auto T = readln.chomp.to!int; auto A = readln.split.map!(to!int).array; auto dp = new char[][](N, T+1); dp[0][A[0]] = '+'; foreach (i; iota(N-1)) foreach (j; iota(T+1)) { if (dp[i][j] != char.init) { if (j * A[i+1] <= T && dp[i+1][j*A[i+1]] == 0xFF) dp[i+1][j*A[i+1]] = '*'; if (j + A[i+1] <= T) dp[i+1][j+A[i+1]] = '+'; } } string ans = ""; foreach (i; iota(N-1, 0, -1)) { ans = dp[i][T] ~ ans; if (dp[i][T] == '*') T /= A[i]; else T -= A[i]; } writeln(ans); }