To congratulate Derek for passing MCR3U (Functions 11), Shane decides to buy Derek a present. In the spirit of problem-solving, he buys him a game called Fiducial.
Fiducial is a multi-player game involving a stack of one black, red, and gold tiles. The red and gold tiles are stacked vertically on top of the black tile, and the goal is to be the person that picks up the black tile. During an player's turn, the player picks up the indicator, the top-most tile, keeps it, and makes note of its colour. They will then continue picking up tiles until either the tower runs out, or the tile they pick up has the same colour as the indicator, at which point they will keep that tile and their turn ends. Then, the next player begins their turn.
Derek and Shane decide to play Fiducial with their friends. In total, there are people playing. To see if Derek's passing grade was a fluke, Shane challenges Derek to set up the stack in such a way that he will win if he goes first. Given the number of red and gold tiles they play with (there will always be one black tile), determine a possible tower configuration such that Derek will win if he goes first, or if it is impossible.
Constraints
The sum of will not exceed .
Input Specification
The first and only line will contain space-separated integers, , , and .
Output Specification
If a configuration is possible, output a string, representing the initial tower. Any tower configuration will suffice, as long as it is valid. b
will always be the first character of the tower, followed by r
s and g
s in some order.
If a configuration is not possible, output -1
.
Subtasks
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [80%]
No additional constraints.
Sample Input 1
4 4 4
Sample Output 1
bggggrrrr
Sample Explanation 1
After Derek's turn, the tower looks like this: bggggrr
. After the second player's turn, the tower looks like this: bgggg
. After the third and fourth player's turns, the tower looks like this: b
. After the fourth player's turn, it is Derek's turn. Thus, he can grab the b
and win.
Sample Input 2
2 10 3
Sample Output 2
bgrrrrrrrrgrgr
Sample Input 3
30 15 3
Sample Output
-1
Comments