1220.Look for homework

Time Limit: 1000 MS    Memory Limit: 131072 KB
Total Submission(s): 178    Accepted Submission(s): 74

Description

(the picture has no relation with this problem..I just want to add a picture. emmm..)

Super scholar robs the all homework of others. The monitor decides to combat with the super scholar so as to help students to get back the homework. But super scholar lives in a castle because he doesn't want to be disturbed. The outside of the castle is a maze with two dimension grids. Entering the castle must pass the maze. The monitor needs to save time because of accompanying his girlfriend, so he wants to make a student named Huachao Wei help him who hasn't a girlfriend. Now he has the map of the maze and needs to calculate the shortest path.

Input

The input consists several cases.For each case starts with two integers n,m(‚Äč),symbolizing the length and width of the maze.The next n lines contain m numbers with no space and value for only 0 and 1.The essence is that 0 can pass ,1 can't pass. Now you are in the place of (1,1) refering to the top left corner.the export is in the place of (n,m).Each step can only walk with up,down,left and right.

Output

For each case,the first line prints the least number of steps to arrive the castle.The second line prints k characters for U,D,L,R,representing up,down,left,right.if there are many paths with the same length,please print the path with Minimum dictionary.It is guarantees that there must have a path for arriving the castle.

Sample Input

3 3
001
100
110
3 3
000
000
000

Sample Output

4
RDRD
4
DDRR

Source

Unknown