Олимпиадный тренинг

Задача 33531. Row of numbers


Задача

Темы:
Legend has it that Carl Friedrich Gauss, while at school, was able to quickly calculate the sum of integers from 1 to 100, noting that 1 + 100 = 2 + 99 = … \u003d 50 + 51. Now solve a more difficult problem: is it possible to place "+" signs in front of each of the numbers from 1 to N? or "–" so that the sum of the resulting numbers is 0? For example, for N = 3 the sum –1 –2 +3 will be equal to 0, but for N = 2 this cannot be done. The program receives as input a non-negative integer N, not exceeding 105.
The program should output a sequence of N characters "+" or "–", corresponding to the signs that need to be placed in front of numbers from 1 to N so that the sum of the resulting numbers is equal to 0. If the problem has several solutions, you need print one (any) answer. If the problem has no solution for the given N, print
one word «IMPOSSIBLE».
 
Input Output Note
3 --+ The correct answer is also «++-»
2 IMPOSSIBLE