Time limit
2s
Memory limit
128 MB
Oh Sejun is an alien robot. He has been on Earth for 100,000 years to conquer it, and until June 25, 2008, he was slowly returning to his original form. Lee Jeongmun knew this and had already planted a mine, the only weapon that could stop him. The mine is ready, but Sejun still has to be made to step on it. Fortunately, with Kim Hyungtaek's help, Lee Jeongmun hacked Sejun's behavior system and can now control him as he wishes.
The ground is an infinite grid of coordinate cells. Sejun is currently at (SejunX, SejunY), and the mine is at (mineX, mineY).
Sejun's program is a command sequence of length N. There are only two commands.
U: if Sejun is at (x, y), he moves to (x, y+1).R: if Sejun is at (x, y), he moves to (x+1, y).Commands are executed from first to last in order. After the last command is executed, execution repeats from the first command again.
If Sejun reaches the cell containing the mine, the program stops immediately. Write a program that outputs a command sequence of length N that makes Sejun step on the mine.
The first line contains the command length N, Sejun's current position SejunX SejunY, and the mine's position mineX mineY. N is a positive integer at most 50, and every coordinate is a nonnegative integer at most 1,000,000,000.
Print a command sequence of length N that can move Sejun onto the mine. If there is more than one valid answer, print the lexicographically smallest one. If no command sequence can make Sejun step on the mine, print -1.
URU can also move Sejun onto the mine, but it is not the lexicographically smallest answer.