import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!int).array; auto B = readln.split.map!(to!int).array; int ans = N.iota.map!(i => abs(A[i] - B[i])).sum; ans.writeln; void dfs(int i) { if (i == N) return; if (A[i] >= B[i]) { foreach (_; 0..A[i] - B[i]) writeln(i+1, " L"); dfs(i + 1); } else { while (i != N - 1 && A[i] < B[i] && A[i] + 1 < A[i + 1]) { A[i] += 1; writeln(i + 1, " R"); } if (A[i] == B[i]) dfs(i + 1); else { dfs(i + 1); while (A[i] < B[i]) { writeln(i + 1, " R"); A[i] += 1; } } } } dfs(0); }