403747: GYM101252 J Choreographer Problem

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Choreographer Problemtime limit per test2 secondsmemory limit per test64 megabytesinputinput.txtoutputoutput.txt

As you probably know, choreography is the art of making dances. But it is not a so well-known fact that it is also the science of making dances.

There are n dancers numbered from 1 to n in the dance troupe, and all of them are working hard to create a new original dance. Before the dance starts each dancer puts on his special hand-made costume, and he has to wear this costume for the duration of the entire dance.

It is known that the costume of i-th dancer is similar to the costumes of (i - 1)-th and (i + 1)-th dancers (therefore the dancers are similar too), but at the same time, i-th dancer is not similar to any other dancer. Therefore, (i - 1)-th and (i + 1)-th dancers are not similar. If n > 1, then the first dancer has the only similar dancer, the last dancer has the only similar dancer, and all other dancers have exactly two similar dancers.

The dance starts and ends with an empty stage. The stage should not be empty during the dance. Each minute one of the following changes happens on the stage:

  • one dancer (who is currently not on the stage) appears;
  • one dancer (who is currently on the stage) leaves the stage;
  • one dancer takes the place of another dancer similar to him/her (basically the dancers switch over — one dancer leaves the stage, while a similar dancer appears on the stage)

At every moment of time the stage must not have more than k dancers, because spectators may lose attention if there are too many dancers on the stage.

Now choreographer is thinking about arranging the dance in such a way that each set of the dancers containing no more than k dancers appears on the stage exactly once. Your job is to write a program to help the choreographer.

Input

The first line contains two positive integer numbers n, k (1 ≤ n ≤ 20;1 ≤ k ≤ n).

Output

Print the only line describing the dance. The substring «+i» means that the i-th dancer appears on the stage, the substring «-i» means that the i-th dancer leaves the stage. The substring «++i» means that the i-th dancer leaves while the similar (i + 1)-th dancer appears, and «-–i» means that the i-th dancer leaves while the similar (i - 1)-th dancer appears. The output will be processed from the left to the right.

If there are many solutions, you may output any of them. If there is no solution, print 0 to the only line of output.

ExamplesInput
2 1
Output
+1++1-2

加入题单

上一题 下一题 算法标签: