import java.util.*;
public class Main {
public static void main(String[] args) {
new Main().solve();
}
private static final int[] dx = {1, 0, -1, 0};
private static final int[] dy = {0, 1, 0, -1};
private static final String[] ds = {"L", "U", "R", "D"};
private Main.XorShift random = new Main.XorShift();
int h, w, k, t;
int[] cars, goal;
String dir(int a, int b, int c, int d) {
int ac = a - c;
int bd = b - d;
if (ac == 0 && bd == 0) return "-";
for (int i = 0; i < 4; ++i) {
if (ac == dy[i] && bd == dx[i]) return ds[i];
}
throw new RuntimeException(ac + " " + bd);
}
void solve() {
try (Scanner in = new Scanner(System.in)) {
h = in.nextInt();
w = in.nextInt();
k = in.nextInt();
t = in.nextInt();
long start = System.currentTimeMillis();
cars = new int[k * 2];
goal = new int[k * 2];
for (int i = 0; i < k; ++i) {
cars[i * 2 + 0] = in.nextInt() - 1;
cars[i * 2 + 1] = in.nextInt() - 1;
goal[i * 2 + 0] = in.nextInt() - 1;
goal[i * 2 + 1] = in.nextInt() - 1;
}
PriorityQueue<State> queue[] = new PriorityQueue[t];
for (int i = 0; i < t; ++i) queue[i] = new PriorityQueue<>();
State best = new State(null, cars, 0);
int L = 0;
queue[0].add(best);
boolean used[] = new boolean[h * w + 1];
int NE[] = new int[10];
int value[] = new int[5];
int C = h / 2;
int selectSort[][] = new int[k][2];
long time = 0;
end:
while (true) {
for (int i = 0; i < t / 10; ++i) {
if (i % 100 == 0) {
time = System.currentTimeMillis() - start;
if (time > 3700) break end;
}
State now = queue[i].poll();
if (now == null) continue;
if (best.score < now.score) {
best = now;
L = i;
}
for (int j = 0; j < k; ++j) {
selectSort[j][0] = j;
selectSort[j][1] = dist(now.cars[j * 2], now.cars[j * 2 + 1], goal[j * 2], goal[j * 2 + 1]);
}
Arrays.sort(selectSort, (a, b) -> b[1] - a[1]);
boolean fin = time > 3300;
for (int j = 0; j < 5; ++j) {
int next[] = Arrays.copyOf(now.cars, now.cars.length);
Arrays.fill(used, false);
for (int x = 0; x < k; ++x) {
used[next[x * 2] * h + next[x * 2 + 1]] = true;
}
for (int si = 0; si < k; ++si) {
int x = selectSort[si][0];
int a = next[x * 2];
int b = next[x * 2 + 1];
int c = 1;
NE[0] = a;
NE[1] = b;
int goalDist = dist(a, b, goal[x * 2], goal[x * 2 + 1]);
value[0] = 1 + (goalDist == 0 ? 5 : 0);
if (fin && goalDist == 0) {
} else {
for (int z = 0; z < 4; ++z) {
int na = a + dy[z];
int nb = b + dx[z];
if (!in(na, nb) || used[na * h + nb]) continue;
boolean up = goalDist > dist(na, nb, goal[x * 2], goal[x * 2 + 1]);
boolean center = dist(a, b, C, C) > dist(na, nb, C, C);
NE[c * 2 + 0] = na;
NE[c * 2 + 1] = nb;
value[c] = 1 + (up ? 10 : 0) + (center ? 0 : 2);
++c;
}
}
int v = random(NE, c, value);
next[x * 2] = NE[v * 2];
next[x * 2 + 1] = NE[v * 2 + 1];
used[next[x * 2] * h + next[x * 2 + 1]] = true;
}
queue[i + 1].add(new State(now, next, i));
}
}
}
List<String> move = new ArrayList<>();
while (best.prev != null) {
StringBuilder m = new StringBuilder();
int[] nc = best.cars;
int[] pc = best.prev.cars;
for (int i = 0; i < k; ++i) {
m.append(dir(pc[i * 2], pc[i * 2 + 1], nc[i * 2], nc[i * 2 + 1]));
}
m.append("\n");
move.add(m.toString());
best = best.prev;
}
Collections.reverse(move);
StringBuilder res = new StringBuilder();
res.append(L).append("\n");
for (String s : move) res.append(s);
System.out.println(res);
}
}
int random(int ne[], int c, int value[]) {
int sum = 0;
for (int i = 0; i < c; ++i) {
sum += value[i];
}
int x = random.nextInt(sum);
for (int i = 0; i < c; ++i) {
if (x < value[i])
return i;
x -= value[i];
}
throw new RuntimeException();
}
boolean in(int a, int b) {
return 0 <= a && a < h && 0 <= b && b < w;
}
class State implements Comparable<State> {
State prev;
int cars[];
double score;
State(State prev, int[] cars, int L) {
this.prev = prev;
this.cars = cars;
this.score = score(cars, goal, L);
}
@Override
public int compareTo(State o) {
return Double.compare(o.score, score);
}
}
int dist(int a, int b, int c, int d) {
return Math.abs(a - c) + Math.abs(b - d);
}
double score(int[] cars, int[] goal, int L) {
int pd = 20;
for (int i = 0; i < k; ++i) {
pd += dist(cars[i * 2], cars[i * 2 + 1], goal[i * 2], goal[i * 2 + 1]);
}
double pt = 10.0 + L * 0.01;
return 10000000.0 / (pd * pt);
}
private final class XorShift {
int x = 123456789;
int y = 362436069;
int z = 521288629;
int w = 88675123;
int nextInt(int n) {
final int t = x ^ (x << 11);
x = y;
y = z;
z = w;
w = (w ^ (w >>> 19)) ^ (t ^ (t >>> 8));
final int r = w % n;
return r < 0 ? r + n : r;
}
int nextInt() {
final int t = x ^ (x << 11);
x = y;
y = z;
z = w;
return w = (w ^ (w >>> 19)) ^ (t ^ (t >>> 8));
}
long nextLong() {
return ((long) nextInt() << 32) | (long) nextInt();
}
}
private void tr(Object... o) {
System.err.println(Arrays.deepToString(o));
}
}