eolymp
bolt
Try our new interface for solving problems
Problems

Expression

Expression

Given $n$ integers $x_1, x_2, ..., x_n$. Arrange between them the signs "+" and "-" so that the value of the resulting expression is equal to $s$. \InputFile The first line contains two values $n~(2 \le n \le 24)$ and $s~(-10^9 \le s \le 10^9)$. The next line contains $n$ integers $x_1, x_2, ..., x_n~(0 \le x_i \le 5 \cdot 10^7)$. \OutputFile If it is impossible to get the result, print "\textbf{No solution}". Otherwise print the equality. If the solution is not unique, print any.
Time limit 1 second
Memory limit 128 MiB
Input example #1
3 10
15 25 30
Output example #1
15+25-30=10