#include #define rep(i, l, r) for (int i = (l); i < (r); i++) using namespace std; typedef long long ll; int main() { int N, M = 0; cin >> N; vector A(N), B(N), L(0), R(0); rep(i, 0, N) cin >> A[i]; rep(i, 0, N) cin >> B[i]; rep(i, 0, N) { if (A[i] > B[i]) L.push_back(i); if (A[i] < B[i]) R.push_back(i); M += abs(A[i] - B[i]); } sort(L.begin(), L.end()); sort(R.begin(), R.end()); cout << M << endl; rep(i, 0, L.size()) { int k = L[i]; rep(j, 0, A[k] - B[k]) cout << k + 1 << " L" << endl; } rep(i, 0, R.size()) { int k = R[R.size() - 1 - i]; rep(j, 0, B[k] - A[k]) cout << k + 1 << " R" << endl; } }