AT_past19_h 加算と乗算
Description
You are given an integer $ S $ , and $ N $ integers $ a_1,a_2,\dots,a_N $ .
Can you construct a mathematical expression that evaluates to $ S $ using $ + $ , $ \times $ , and the $ N $ integers?
Here,
- use each of the $ N $ integers exactly once.
- You can freely rearrange the integers.
- You may not use parentheses.
- You may not join integers without an operator in between (for example, join $ 1 $ and $ 2 $ to form $ 12 $ ).
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ S $ $ a_1 $ $ a_2 $ $ \dots $ $ a_N $
Output Format
Print `No` if one cannot construct a mathematical expression that evaluates to $ S $ .
If it is possible, print one in the following format, where $ E $ is a sought expression.
> Yes $ E $
The expression must not contain a whitespace or a newline. The operators $ + $ and $ \times $ must be represented by `+` and `x`.
For example, if you want to print the expression $ 1 \times 2 + 3 \times 4 \times 5 $ , it must be printed in the following format:
```
1x2+3x4x5
```
If there are multiple solutions, printing any of them is accepted.
Explanation/Hint
### Sample Explanation 1
The expression $ 1 + 2 \times 5 $ satisfies the conditions in the problem statement, so you may print this.
The expression $ 2 \times 5 + 1 $ also satisfies the conditions, so printing it is also accepted.
### Sample Explanation 2
If the same integer occurs in $ a_1, a_2, \dots, a_N $ multiple times, use it as many times as it occurs.
### Constraints
- $ 2 \leq N \leq 6 $
- $ 1 \leq S \leq 10^{18} $
- $ 1 \leq a_i \leq 1000 $
- All input values are integers.