#include #include #include #include #include #include #include void printShortestPath(int n, int xs, int ys, int xe, int ye) { // Print the distance along with the sequence of moves. if(abs(xe-xs)%2 != 0) printf("Impossible\n"); else { int k = abs(xe-xs)/2; if(abs(k-abs(ye-ys)) %2 != 0) { printf("Impossible\n"); } else { int ans =k; if(abs(ye-ys) > k ) { ans = ans+abs(k-abs(ye-ys))/2; } printf("%d\n",ans); while(xs != xe || ys != ye) { if(xs == xe) { if(ys > ye ) { printf("L "); ys = ys-2; } else { printf("R "); ys = ys+2; } } else { int k1; char ch; if(xs < xe) { k1 = 2; ch = 'L'; } else { k1 = -2; ch = 'U'; } if(ys > ye ) { printf("%cL ",ch); xs = xs+k1; ys = ys-1; } else { printf("%cR ",ch); xs = xs+k1; ys = ys+1; } } } } } } int main() { int n; scanf("%i", &n); int i_start; int j_start; int i_end; int j_end; scanf("%i %i %i %i", &i_start, &j_start, &i_end, &j_end); printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }