#include using namespace std; 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. int x = j_end - j_start; int y = i_start - i_end; if(x == 0){ if(abs(y)%4 == 0){ cout << abs(y)/2 << endl; if(y > 0){ int UL = y/4; int UR = y/4; while(UL > 0 || UR > 0){ if(j_start == 0 || UL == 0) {cout << "UR "; UR--; j_start++;} else {cout << "UL ";UL--;j_start--;} } }else{ int UL = abs(y)/4; int UR = abs(y)/4; while(UL > 0 || UR > 0){ if(j_start == n - 1 || UL == 0) {cout << "LL "; UR--; j_start--;} else {cout << "LR ";UL--;j_start++;} } } }else{ cout << "Impossible" << endl; } }else if(y == 0){ if(abs(x)%2 == 0){ cout << abs(x)/2 << endl; if(x > 0){ int R = abs(x)/2; while(R){cout << "R ";R--;} }else{ int R = abs(x)/2; while(R){cout << "L ";R--;} } }else{ cout << "Impossible" << endl; } }else{ int ay = abs(y); int ax = abs(x); if(ay&1){ cout << "Impossible" << endl; return; } if((ay/2 + ax)&1){ cout << "Impossible" << endl; return; } int V = ay/2; if(ax >= V){ int H = (ax - V)/2; cout << V+H << endl; if(x > 0 && y > 0){ while(V--)cout << "UR "; while(H--)cout << "R "; }else if(x < 0 && y > 0){ while(V--)cout << "UL "; while(H--)cout << "L "; }else if(x > 0 && y < 0){ while(H--)cout << "R "; while(V--)cout << "LR "; }else{ while(V--)cout << "LL "; while(H--)cout << "L "; } }else{ cout << ay/2 << endl; if(x > 0 && y > 0){ int UR = (ax + ay/2)/2; int UL = (ay/2 - ax)/2; while(UL > 0 || UR > 0){ if(j_start == 0 || UL == 0) {cout << "UR "; UR--; j_start++;} else {cout << "UL ";UL--;j_start--;} } }else if(x < 0 && y > 0){ int UL = (ax + ay/2)/2; int UR = (ay/2 - ax)/2; while(UL > 0 || UR > 0){ if(j_start == 0 || UL == 0) {cout << "UR "; UR--; j_start++;} else {cout << "UL ";UL--;j_start--;} } }else if(x > 0 && y < 0){ int UL = (ax + ay/2)/2; int UR = (ay/2 - ax)/2; while(UL > 0 || UR > 0){ if(j_start == 0 || UL == 0) {cout << "LL "; UR--; j_start--;} else {cout << "LR ";UL--;j_start++;} } }else{ int UR = (ax + ay/2)/2; int UL = (ay/2 - ax)/2; while(UL > 0 || UR > 0){ if(j_start == 0 || UL == 0) {cout << "LL "; UR--; j_start++;} else {cout << "LR ";UL--;j_start--;} } } } } return; } int main() { int n; cin >> n; int i_start; int j_start; int i_end; int j_end; cin >> i_start >> j_start >> i_end >> j_end; printShortestPath(n, i_start, j_start, i_end, j_end); return 0; }