Mirko has grown tired of all the books, so he decided to go to the amusement park with his friends, despite not liking roller coasters. While his friends are having the time of their lives riding the coasters, Mirko is sitting on a bench, waiting and thinking about the possible paths of the coasters.
The amusement park's area can be represented as a table of
Each cell has a positive integer value associated with it, specifying how amusing that cell is to visitors. The total amusement value of the coaster is the sum of amusement values of all cells that the coaster visits. Help Mirko determine any one of the most amusing coasters (ones with the maximum sum).
Input Specification
The first line of input contains two integers
Each of the next
Output Specification
The first and only line of output must contain a sequence of letters with no blanks. The letters specify the sequence of directions that the coaster follows, starting from the upper left and ending at the lower right corner. The directions up, right, down, left are marked by letters U
, R
, D
, L
, respectively.
Note: The solution isn't guaranteed to be unique.
Scoring
Test cases worth
Sample Input 1
3 3
5 1 3
2 4 8
1 1 2
Sample Output 1
RRDLLDRR
Sample Input 2
2 2
2 1
3 4
Sample Output 2
DR
Comments