from heapq import heapify, heappop as pop, heappush as push D = ((-1, 0), (0, -1), (0, 1), (1, 0)) def solve(H, W, P): stop_cnt = [[0]*(H*W) for _ in range(H*W)] is_empty = [[False]*(H*W) for _ in range(H*W)] def rc2idx(row, col): return row*W+col def idx2rc(idx): return idx//W, idx%W def is_empty_idx(idx1, idx2): return is_empty[idx1][idx2] def is_empty_rc(row1, col1, row2, col2): return is_empty_idx(rc2idx(row1, col1), rc2idx(row2, col2)) def empty_per_idx(idx1, idx2): return 0 def empty_per_rc(row1, col1, row2, col2): return empty_per_idx(rc2idx(row1, col1), rc2idx(row2, col2)) def through_per_idx(idx1, idx2): if is_empty_idx(idx1, idx2): return (100-P)/100 return (pow(P, stop_cnt[idx1][idx2])/pow(100, stop_cnt[idx1][idx2]-1)-P)/100 def through_per_rc(row1, col1, row2, col2): return through_per_idx(rc2idx(row1, col1), rc2idx(row2, col2)) def cmd_rc(row1, col1, row2, col2): if row1 > row2: return "U" if row1 < row2: return "D" if col1 > col2: return "L" if col1 < col2: return "R" for try_cnt in range(1, 1000+1): q = [(-1, 0, 0)] fixed = [[False]*W for _ in range(H)] dist = [[10]*W for _ in range(H)] prev = [[None]*W for _ in range(H)] while q: qper, qh, qw = pop(q) if fixed[qh][qw]: continue fixed[qh][qw] = True for a, b in D: h = qh+a; w = qw+b if not 0 <= h < H: continue if not 0 <= w < W: continue if fixed[h][w]: continue per = -(-qper*through_per_rc(qh, qw, h, w)) if dist[h][w] < per: continue q.append((per, h, w)) prev[h][w] = (qh, qw) dist[h][w] = per nodes = [] h, w = H-1, W-1 while h+w: nodes.append((h, w)) h, w = prev[h][w] nodes.append((0, 0)) nodes.reverse() cmd = [] for i in range(len(nodes)-1): cmd.append(cmd_rc(nodes[i][0], nodes[i][1], nodes[i+1][0], nodes[i+1][1])) print(*cmd, sep="") through_cnt = int(input()) if through_cnt == -1: return for i in range(through_cnt): idx1, idx2 = rc2idx(*nodes[i]), rc2idx(*nodes[i+1]) is_empty[idx1][idx2] = True is_empty[idx2][idx1] = True idx1, idx2 = rc2idx(*nodes[through_cnt]), rc2idx(*nodes[through_cnt+1]) stop_cnt[idx1][idx2] += 1 H, W, P = map(int, input().split()) solve(H, W, P)