import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static void printShortestPath(int n, int i_start, int j_start, int i_end, int j_end) { // Print the distance along with the sequence of moves. if(!isFeasible(n, i_start, j_start, i_end, j_end)){ System.out.println("Impossible"); } else{ String moves = ""; int count = 0; //System.out.println("start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); while(i_start != i_end || j_start != j_end){ boolean moveL = false; if(i_end < i_start){ if(j_end < j_start){ //moveUL count++; i_start--; i_start--; j_start--; moves = moves + "UL "; //System.out.println("moveUL start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } else{ //moveUR count++; i_start--; i_start--; j_start++; moves = moves + "UR "; //System.out.println("moveUR start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } } else{ if(i_end == i_start){ if(j_end > j_start){ //moveR count++; j_start++; j_start++; moves = moves + "R "; //System.out.println("moveR start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } else{ moveL = true; } } else{ if(j_end >= j_start){ //moveLR count++; i_start++; i_start++; j_start++; moves = moves + "LR "; //System.out.println("moveLR start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } else{ //moveLL count++; i_start++; i_start++; j_start--; moves = moves + "LL "; //System.out.println("moveLL start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } } } if(moveL == true){ //moveL count++; j_start--; j_start--; moves = moves + "L "; //System.out.println("moveL start: " + i_start + " " + j_start + " end: " + i_end + " " + j_end); } } System.out.println(count); System.out.println(moves);} } static boolean isFeasible(int n, int i_start, int j_start, int i_end, int j_end){ if(i_start >= n && j_start >= n && i_end >= n && j_end >= n && i_start <= 0 && j_start <= 0 && i_end <= 0 && j_end <= 0){ return false; } //watch out for X if(i_start%2 == 0){ if(i_end%2 != 0){ return false; } } if(i_start%2 != 0){ if(i_end%2 == 0){ return false; } } return true; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int i_start = in.nextInt(); int j_start = in.nextInt(); int i_end = in.nextInt(); int j_end = in.nextInt(); printShortestPath(n, i_start, j_start, i_end, j_end); in.close(); } }