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
shanky200: 2023-08-17 08:27:49

getting TLE using Java , at TC 25 , pls help !

kinhkong69z: 2022-11-24 09:24:39

<snip>
I'm right ?

[Simes]: use the forum for questions about code

Last edit: 2022-11-24 09:30:05
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


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