n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) l = [] kaisu = 0 flg = 0 q_flg = 0 cnt = 0 for i in range(n): if a[i] == b[i]: cnt += 1 continue kaisu += abs(a[i] - b[i]) flg = 1 if a[i] > b[i] else -1 if q_flg != flg: ren = 1 cnt += 1 else: ren += 1 l.append((i+1,flg * ren,cnt)) q_flg = flg print(kaisu) l.sort(key = lambda x :(x[2],x[1])) for i,ren,cnt in l: mark = "R" if a[i-1] < b[i-1] else "L" for j in range(abs(a[i-1] - b[i-1])): print(i,mark)