The correct way of evaluating an expression with *, +, and - is, first multiplication, then addition, and then subtraction. For example, the expression 2+3*7-5 = 2+21-5 = 23-5 = 18.

You are given integers N and X. Your task is to generate a string S of length N consisting only of *, +, and - such that when these N operators are placed in order between (N+1) ones, the result of the expression becomes X.  
For example, if S = ++-*-, the resulting expression is 1+1+1-1*1-1, which is then evaluated based on the rules above.

If multiple such strings exist, print any of them. If no such string exists, print -1 instead. 

------ Input Format ------ 

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of two space-separated integers N and X — the number of characters in the string and the result of expression after appending (N+1) ones between all operators.

------ Output Format ------ 

For each test case, output on a new line a string S of length N consisting only of *, +, and - that satisfies the given condition.

If multiple such strings exist, print any of them. If no such string exists, print -1 instead.

------ Constraints ------ 

$1 ≤ T ≤ 2000$
$1 ≤ N ≤ 10^{5}$
$-10^{5} ≤ X ≤ 10^{5}$
- The sum of $N$ over all test cases won't exceed $2\cdot 10^{5}$.

----- Sample Input 1 ------ 
3
3 4
2 -5
3 1

----- Sample Output 1 ------ 
+++
-1
*+-

----- explanation 1 ------ 
Test case $1$: A possible string satisfying the condition is +++. The corresponding expression is $1+1+1+1 = 4$ which is equal to $X$.

Test case $2$: It can be proven that no such string with length $N=2$ exists such that the corresponding expression evaluates to $-5$.

Test case $3$: A possible string satisfying the condition is *+-. The corresponding expression is $1*1+1-1 = 1+1-1 = 2-1 = 1$ which is equal to $X$.  
Note that there are other valid strings, such as +*- and -*+. Any valid string will be accepted as output.

Source: codechef | Difficulty: EASY
Tags: Constructive algorithms


Solutions:
T = int(input())
for i in range(T):
	a = input()
	(N, X) = [int(i) for i in a.split(' ')]
	string = ''
	if N % 2 == 0 and X % 2 == 0 or (N % 2 != 0 and X % 2 != 0):
		string += '*'
		N -= 1
	if X < 0:
		x = -X + 1
	else:
		x = X - 1
	if x > N:
		print(-1)
	else:
		A = int((x + N) / 2)
		B = int((N - x) / 2)
		if X < 0:
			string += '-' * A + '+' * B
		else:
			string += '+' * A + '-' * B
		print(string)


T = int(input())
for i in range(T):
	(N, X) = map(int, input().split())
	if X > N + 1 or X <= -N:
		print('-1')
	else:
		if X >= 1:
			print('+' * (X - 1), end='')
			flag = 1
		else:
			print('-' * (1 - X), end='')
			flag = -1
		numbers = N - flag * (X - 1)
		if numbers % 2 == 0:
			print('+' * int(numbers / 2), end='')
			print('-' * int(numbers / 2), end='')
		else:
			print('*', end='')
			print('+' * int((numbers - 1) / 2), end='')
			print('-' * int((numbers - 1) / 2), end='')
		print()


t = int(input())
while t > 0:
	(n, x) = map(int, input().split())
	k = (n + 1 + x) // 2
	if x > n + 1:
		print(-1)
	elif x == n + 1:
		print('+' * n)
	elif x == 1 - n:
		print('-' * n)
	elif x < 1 - n:
		print(-1)
	elif (n + 1) % 2 == x % 2:
		print('+' * (k - 1), end='')
		print('-' * (n + 1 - k))
	elif (n + 1) % 2 != x % 2:
		print('*', end='')
		print('+' * ((n + x) // 2 - 1), end='')
		print('-' * (n - (n + x) // 2))
	t = t - 1