import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
public class Main
{
public static int[] dx = {1,0,-1,0};
public static int[] dy = {0,1,0,-1};
static Scanner sc = new Scanner(System.in);
//static int[] arr;
static ArrayList<String> list = new ArrayList<>();
static int[] capa ;
static int[] cur;
static int[][] map;
static HashSet<Integer> set ;
static int n,m,k;
static HashMap<Integer, Integer> car = new HashMap<Integer,Integer>();
static HashMap<Integer, Integer> destination = new HashMap<Integer,Integer>();
public static void main(String[] args){
//String line = sc.nextLine();
int H =sc.nextInt();
int W = sc.nextInt();
int K = sc.nextInt();
int T= sc.nextInt();
map = new int[H+1][W+1];
for(int i=0; i<K; i++){
int x = sc.nextInt();
int y = sc.nextInt();
int fx = sc.nextInt();
int fy = sc.nextInt();
car.put(i, x*1000+y);
destination.put(i, fx*1000+fy);
//map[x][y] = 1;
}
boolean o = true;
for(int i=0; i<T ; i++){
map = new int[H+1][W+1];
for(Map.Entry<Integer, Integer> e:car.entrySet()){
int x = e.getValue()/1000;
int y = e.getValue()%1000;
map[x][y]=1;
}
StringBuilder sb = new StringBuilder();
o = false;
for(Map.Entry<Integer, Integer> e : car.entrySet()){
int num = e.getKey();
int cur = e.getValue();
int x = e.getValue()/1000;
int y = e.getValue()%1000;
int fx = destination.get(num)/1000;
int fy = destination.get(num)%1000;
int dis = Math.abs(fx-x)+Math.abs(fy-y);
if(x==fx&& y == fy){
sb.append("-");
continue;
}
ArrayList<Integer[]> memo = new ArrayList<>();
for(int j=0; j<4; j++){
int nx = x+dx[j];
int ny = y + dy[j];
int def = Math.abs(fx-nx)+Math.abs(fy-ny);
if(nx>=1 && nx<=H && ny>=1 && ny<=W && map[nx][ny]==0
&& (checkR(x, j)||checkL(y, j)) ){
cur = nx*1000+ny;
// car.put(num, cur);
// map[nx][ny]=1;
memo.add(new Integer[]{def,cur,j});
//sb.append(next(j));
o = true;
//break;
}
}
if(memo.size()>0){
Collections.sort(memo,(a,b)->a[0]-b[0]);
cur = memo.get(0)[1];
int nn = memo.get(0)[2];
sb.append(next(nn));
car.put(num, cur);
int nx = cur/1000;
int ny = cur%1000;
map[nx][ny]=1;
}
else sb.append("-");
}
if(!o)break;
list.add(sb.toString());
}
System.out.println(list.size());
for(String s: list)System.out.println(s);
}
public static String next(int i) {
if(i==0)return "D";
if(i==1)return "R";
if(i==2)return "U";
if(i==3)return "L";
return "-";
}
public static boolean checkR(int x, int j) {
if(x%2==0 && j==0)return true;
if(x%2==1 && j==2)return true;
return false;
}
public static boolean checkL(int y, int j) {
if(y%2==0 && j==1)return true;
if(y%2==1 && j==3)return true;
return false;
}
}