PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000024. Tính toán trong chương trình truyền hình (Game Show Math)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Tính toán trong chương trình truyền hình (Game Show Math)

Game Show Math

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A game show provides NN positive integers a1,a2,…,aNa_1,a_2,\ldots,a_N in fixed order and a target TT. Insert exactly one operator from +, -, *, / between each pair of adjacent numbers to obtain TT.

Evaluate operations strictly from left to right, ignoring the usual multiplication and division precedence. Division must be exact. After each operation, the intermediate result must stay within [−32000,32000][-32000,32000]. The numbers may not be reordered.

Print any valid expression, or NO EXPRESSION if no expression exists.

Input

The first line contains NN.

The second line contains the NN positive integers in their fixed order.

The third line contains target integer TT.

Output

Print any valid expression without spaces using the input numbers in order, with operators between them and =T at the end. Print NO EXPRESSION if impossible.

Subtasks

  • Subtask 1 (20 points): 1≤N≤101\le N\le 10; 1≤ai≤319991\le a_i\le 31999; 1≤T≤320001\le T\le 32000; Intermediate results must lie within [−32000,32000][-32000,32000]; division must be exact.
  • Subtask 2 (30 points): 1≤N≤351\le N\le 35; 1≤ai≤319991\le a_i\le 31999; 1≤T≤320001\le T\le 32000; Intermediate results must lie within [−32000,32000][-32000,32000]; division must be exact.
  • Subtask 3 (50 points): 1≤N≤1001\le N\le 100; 1≤ai≤319991\le a_i\le 31999; 1≤T≤320001\le T\le 32000; Intermediate results must lie within [−32000,32000][-32000,32000]; division must be exact.

Examples

Input

3
5 7 4
3

Output

5+7/4=3

Explanation

Evaluate 5+7/4=3 from left to right, without the usual precedence rules. First 5+7=125+7=12, then 12/4=312/4=3. Division is exact and both intermediate values are in range.