-----Problem Statement-----
Chef has a sequence of N segments: [L1, R1], [L2, R2], ..., [LN, RN]. He wants to transform the first segment to the last one (with index N). His plan is to do this big deal with a number of transformations: firstly he will transform

the first segment to the second one, then to the third one, then to the fourth one, and so on till N-th one.

Chef can use operation of a single type: shift one segment border by one unit. So, if he has segment [L, R], he can transform it into one of the following segments: [L + 1, R] (we will denote such operation with string L+), [L, R + 1] (will be denoted as R+), [L - 1, R] (L-), [L, R - 1] (R-). Chef doesn't like empty segments, therefore he cannot use any operation that makes a segment empty (L = R).

Chef really wants to transform his segment as fast as possible. Please, help him. Find the sequence with minimal number of operations that transforms his segment. If there are multiple such sequences pick the lexicographically minimal one.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. 

The first line of each test case contains a single integer N denoting the number of segments Chef has. 

The following N lines contain pairs of integers. The i-th line contains integers Li, Ri, denoting i-th Chef's segment.

-----Output-----
For each test case print an answer - two lines. The first line should contain the minimal number of operations. The second line should contain the sequence of operations

without any whitespaces.

-----Constraints-----
- 1 ≤ T, N ≤ 1000.
- -1000 ≤ Li < Ri ≤ 1000.
The total sum of N values for all test cases doesn't exceed 1000.

-----Example-----
Input:
4
3
-1 0
0 1
3 5
1
0 1
3
-2 -1
-2 -1
-2 0
4
4 6
3 5
-1 1
1 2

Output:
9
R+L+R+L+R+L+R+L+R+
0

1
R+
13
L-R-L-L-L-L-R-R-R-R-L+R+L+

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "for tc in range(int(input())):\n N = int(input())\n a, b = list(map(int, input().split()))\n pr = []\n\n # 'L' is lexicographically lower than 'R'.\n # so, we should first try to apply L+ or L-\n # if we can't then only we'll try to apply R+ or R-\n\n for i in range(N - 1):\n  l, r = list(map(int, input().split()))\n\n  #continue the following process until a == l and b == r\n  while a != l or b != r:\n   # trying to apply L-\n   if a > l:\n    a -= 1\n    pr.append('L-')\n\n   # now, trying to apply L+ (if a < b)\n   elif a + 1 < b and a < l:\n    a += 1\n    pr.append('L+')\n\n   # ok, so far, so good... now, let's try to apply R+\n   elif b < r:\n    b += 1\n    pr.append('R+')\n\n   # finally, lastly, trying to apply R- (if a < b)\n   elif b - 1 > a and b > r:\n    b -= 1\n    pr.append('R-')\n\n print(len(pr))\n print(''.join(pr))"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13535