#include #include #include #include using namespace std; #define P pair int N; vector A, B; vector

op; void dfs(int a) { if (A[a] == B[a]) { return; } if (A[a] > B[a]) { for (int i = 0; i < A[a] - B[a]; i++) { op.push_back(make_pair(a, 'L')); } return; } if (a < N - 1) { dfs(a + 1); } for (int i = 0; i < B[a] - A[a]; i++) { op.push_back(make_pair(a, 'R')); } } int main() { cin >> N; A.resize(N, 0); B.resize(N, 0); for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } for (int i = 0; i < N; i++) { dfs(i); } cout << op.size() << endl; for (int i = 0; i < (int)op.size(); i++) { cout << (op[i].first + 1) << " " << op[i].second << endl; } return 0; }