BLOPER - Operators


Given a set of N integer A = {1, 2, 3, …, N} and a integer S, your task is find a way to insert an operator ‘+’ or ‘-‘ to every neighbor pair of A, that the result of the expression after insert equal to S.

Input

A single line, N and S (1 ≤ N ≤ 500, |S| ≤ 125250)

Output

If there are way(s) to insert, outputs any of them, otherwise outputs “Impossible” (without quotes).

Example

Input:
9 5

Output:
1-2+3-4+5-6+7-8+9
Input:
5 6

Output:
Impossible

hide comments
cryp_bipul17: 2021-03-03 15:31:44

can i use any number of + and - in this question

uj_5: 2021-01-10 12:43:22

What is greedy parameter in it?

mortal745: 2021-01-04 10:13:28

I am using recursion to solve this problem but getting TLE in test case 25. someone please help
code: <snip>

[NG]: Read the footer.

Last edit: 2021-01-04 15:55:14
sarkybastard: 2020-11-04 21:53:22

@raviteja_3272 your solution fails but you cant tell where. it could be on the first, last or every test case.

raviteja_3272: 2020-10-25 19:59:38

test case 25 ??!!! my solution fails on it

lighght: 2020-10-21 14:21:37

is putting a - before 1 valid ???

smap: 2020-09-03 16:24:39

what is test 25 ??!!! my solution fails on it

Shubham Jadhav: 2020-07-17 22:52:37

lots of silly mistakes

seventh_sky: 2020-06-28 09:44:31

getting wrong ans for test25 help odd and even cases working properly

prudhvi_495: 2019-06-11 04:11:53

For those who are getting WA on 23, check (even, 0) pairs with different even numbers like 4,6. 4 will have the solution but 6 don't have. For those getting WA on 25 try (odd, 0) cases.


Added by:Kata
Date:2014-03-28
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64