You've got a robot, its task is destroying bombs on a square plane. Specifically, the square plane contains n bombs, the i-th bomb is at point with coordinates (x_{i}, y_{i}). We know that no two bombs are at the same point and that no bomb is at point with coordinates (0, 0). Initially, the robot is at point with coordinates (0, 0). Also, let's mark the robot's current position as (x, y). In order to destroy all the bombs, the robot can perform three types of operations:  Operation has format "1 k dir". To perform the operation robot have to move in direction dir k (k ≥ 1) times. There are only 4 directions the robot can move in: "R", "L", "U", "D". During one move the robot can move from the current point to one of following points: (x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1) (corresponding to directions). It is forbidden to move from point (x, y), if at least one point on the path (besides the destination point) contains a bomb.  Operation has format "2". To perform the operation robot have to pick a bomb at point (x, y) and put it in a special container. Thus, the robot can carry the bomb from any point to any other point. The operation cannot be performed if point (x, y) has no bomb. It is forbidden to pick a bomb if the robot already has a bomb in its container.  Operation has format "3". To perform the operation robot have to take a bomb out of the container and destroy it. You are allowed to perform this operation only if the robot is at point (0, 0). It is forbidden to perform the operation if the container has no bomb. 

Help the robot and find the shortest possible sequence of operations he can perform to destroy all bombs on the coordinate plane.


-----Input-----

The first line contains a single integer n (1 ≤ n ≤ 10^5) — the number of bombs on the coordinate plane. Next n lines contain two integers each. The i-th line contains numbers (x_{i}, y_{i}) ( - 10^9 ≤ x_{i}, y_{i} ≤ 10^9) — the coordinates of the i-th bomb. It is guaranteed that no two bombs are located at the same point and no bomb is at point (0, 0). 


-----Output-----

In a single line print a single integer k — the minimum number of operations needed to destroy all bombs. On the next lines print the descriptions of these k operations. If there are multiple sequences, you can print any of them. It is guaranteed that there is the solution where k ≤ 10^6.


-----Examples-----
Input
2
1 1
-1 -1

Output
12
1 1 R
1 1 U
2
1 1 L
1 1 D
3
1 1 L
1 1 D
2
1 1 R
1 1 U
3

Input
3
5 0
0 5
1 0

Output
12
1 1 R
2
1 1 L
3
1 5 R
2
1 5 L
3
1 5 U
2
1 5 D
3

Difficulty: MEDIUM_HARD

Solutions:
import sys

def dist(p):
	return abs(p[0]) + abs(p[1])
n = int(input())
pts = []
for i in range(n):
	pts.append(tuple(map(int, input().split())))
pts.sort(key=dist)
ops = []

def move(s, t, direc):
	if s == t:
		return
	if t > s:
		ops.append('1 {} {}'.format(t - s, direc[0]))
	else:
		ops.append('1 {} {}'.format(s - t, direc[1]))
for p in pts:
	move(0, p[0], 'RL')
	move(0, p[1], 'UD')
	ops.append('2')
	move(p[0], 0, 'RL')
	move(p[1], 0, 'UD')
	ops.append('3')
sys.stdout.write(str(len(ops)) + '\n')
sys.stdout.write('\n'.join(ops))


from sys import stdin, stdout

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def mp():
	return map(int, inp().split())
n = iinp()
ml = []
for i in range(n):
	(x, y) = mp()
	ml.append((x, y))
ml.sort(key=lambda x: abs(x[0]) + abs(x[1]))
ansl = []
for (x, y) in ml:
	if x > 0:
		ansl.append('1 ' + str(x) + ' R')
	if x < 0:
		ansl.append('1 ' + str(-x) + ' L')
	if y > 0:
		ansl.append('1 ' + str(y) + ' U')
	if y < 0:
		ansl.append('1 ' + str(-y) + ' D')
	ansl.append('2')
	if x > 0:
		ansl.append('1 ' + str(x) + ' L')
	if x < 0:
		ansl.append('1 ' + str(-x) + ' R')
	if y > 0:
		ansl.append('1 ' + str(y) + ' D')
	if y < 0:
		ansl.append('1 ' + str(-y) + ' U')
	ansl.append('3')
out(len(ansl))
out('\n'.join(ansl))


import sys
from math import log2, floor, ceil, sqrt, gcd
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 1000000007
flag = False
n = int(ri())
res = []
qq = []
for i in range(n):
	(x, y) = Ri()
	qq.append([x, y])
qq.sort(key=lambda x: abs(x[0]) + abs(x[1]))
for i in range(len(qq)):
	(x, y) = qq[i]
	if x > 0:
		res.append('1 %d %c' % (x, 'R'))
	if x < 0:
		res.append('1 %d %c' % (-x, 'L'))
	if y > 0:
		res.append('1 %d %c' % (y, 'U'))
	if y < 0:
		res.append('1 %d %c' % (-y, 'D'))
	res.append('2')
	if x > 0:
		res.append('1 %d %c' % (x, 'L'))
	if x < 0:
		res.append('1 %d %c' % (-x, 'R'))
	if y > 0:
		res.append('1 %d %c' % (y, 'D'))
	if y < 0:
		res.append('1 %d %c' % (-y, 'U'))
	res.append('3')
print(len(res))
print('\n'.join(res))


from sys import stdin, stdout
n = int(stdin.readline())
pos = []
for i in range(n):
	(x, y) = list(map(int, stdin.readline().split()))
	pos.append([x, y])
pos = sorted(pos, key=lambda pos: abs(pos[0]) + abs(pos[1]))
moves = []
for p in pos:
	(x, y) = p
	(xNeg, yNeg) = (False, False)
	(xPos, yPos) = (False, False)
	if x > 0:
		moves.append('1 {} R'.format(x))
		xPos = True
	elif x < 0:
		moves.append('1 {} L'.format(-x))
		xNeg = True
	if y > 0:
		moves.append('1 {} U'.format(y))
		yPos = True
	elif y < 0:
		moves.append('1 {} D'.format(-y))
		yNeg = True
	moves.append('{}'.format(2))
	if xNeg:
		moves.append('1 {} R'.format(-x))
	elif xPos:
		moves.append('1 {} L'.format(x))
	if yNeg:
		moves.append('1 {} U'.format(-y))
	elif yPos:
		moves.append('1 {} D'.format(y))
	moves.append('{}'.format(3))
print(len(moves))
for m in moves:
	stdout.write(m)
	stdout.write('\n')


import io
import os
import sys
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def printd(*args, **kwargs):
	print(*args, **kwargs)
	pass

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
n = oint()
p = []
for i in range(n):
	(x, y) = rint()
	p.append([x, y])
p.sort(key=lambda a: abs(a[0]) + abs(a[1]))
ans = []
for i in range(n):
	(x, y) = p[i]
	if x > 0:
		ans.append(str(1) + ' ' + str(x) + ' R')
	elif x < 0:
		ans.append(str(1) + ' ' + str(-x) + ' L')
	if y > 0:
		ans.append(str(1) + ' ' + str(y) + ' U')
	elif y < 0:
		ans.append(str(1) + ' ' + str(-y) + ' D')
	ans.append('2')
	if x > 0:
		ans.append(str(1) + ' ' + str(x) + ' L')
	elif x < 0:
		ans.append(str(1) + ' ' + str(-x) + ' R')
	if y > 0:
		ans.append(str(1) + ' ' + str(y) + ' D')
	elif y < 0:
		ans.append(str(1) + ' ' + str(-y) + ' U')
	ans.append('3')
print(len(ans))
for a in ans:
	print(a)


from sys import stdin
input = stdin.readline
n = int(input())
seg = [list(map(int, input().split())) for _ in range(n)]
seg = sorted(seg, key=lambda x: abs(x[0]) + abs(x[1]))
res = []
for (x, y) in seg:
	if x > 0:
		res.append('1 %d %c' % (x, 'R'))
	if x < 0:
		res.append('1 %d %c' % (-x, 'L'))
	if y > 0:
		res.append('1 %d %c' % (y, 'U'))
	if y < 0:
		res.append('1 %d %c' % (-y, 'D'))
	res.append('2')
	if x > 0:
		res.append('1 %d %c' % (x, 'L'))
	if x < 0:
		res.append('1 %d %c' % (-x, 'R'))
	if y > 0:
		res.append('1 %d %c' % (y, 'D'))
	if y < 0:
		res.append('1 %d %c' % (-y, 'U'))
	res.append('3')
print(len(res))
print('\n'.join(res))


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
ml = []
for i in range(n):
	(x, y) = mp()
	ml.append((x, y))
ml.sort(key=lambda x: abs(x[0]) + abs(x[1]))
ansl = []
for (x, y) in ml:
	if x > 0:
		ansl.append('1 ' + str(x) + ' R')
	if x < 0:
		ansl.append('1 ' + str(-x) + ' L')
	if y > 0:
		ansl.append('1 ' + str(y) + ' U')
	if y < 0:
		ansl.append('1 ' + str(-y) + ' D')
	ansl.append('2')
	if x > 0:
		ansl.append('1 ' + str(x) + ' L')
	if x < 0:
		ansl.append('1 ' + str(-x) + ' R')
	if y > 0:
		ansl.append('1 ' + str(y) + ' D')
	if y < 0:
		ansl.append('1 ' + str(-y) + ' U')
	ansl.append('3')
out(len(ansl))
out('\n'.join(ansl))


def dist(p):
	return abs(p[0]) + abs(p[1])
n = int(input())
points = []
for i in range(n):
	(x, y) = map(int, input().split())
	points.append((x, y))
points.sort(key=dist)
ans = []
for (x, y) in points:
	if x > 0:
		ans.append('1 %d R' % x)
	if x < 0:
		ans.append('1 %d L' % -x)
	if y > 0:
		ans.append('1 %d U' % y)
	if y < 0:
		ans.append('1 %d D' % -y)
	ans.append('2')
	if x > 0:
		ans.append('1 %d L' % x)
	if x < 0:
		ans.append('1 %d R' % -x)
	if y > 0:
		ans.append('1 %d D' % y)
	if y < 0:
		ans.append('1 %d U' % -y)
	ans.append('3')
print(len(ans))
print('\n'.join(ans))


import sys
input = sys.stdin.readline
n = int(input())
bombs = []
for _ in range(n):
	x = list(map(int, input().split(' ')))
	bombs.append(x)
bombs.sort(key=lambda x: abs(x[0]) + abs(x[1]))
out = []
for b in bombs:
	x = b
	get = []
	back = []
	if x[0] != 0:
		get.append('1 ' + str(abs(x[0])) + ' ' + ('R' if x[0] > 0 else 'L'))
		back.append('1 ' + str(abs(x[0])) + ' ' + ('L' if x[0] > 0 else 'R'))
	if x[1] != 0:
		get.append('1 ' + str(abs(x[1])) + ' ' + ('U' if x[1] > 0 else 'D'))
		back.append('1 ' + str(abs(x[1])) + ' ' + ('D' if x[1] > 0 else 'U'))
	out += get + ['2'] + back + ['3']
ss = '\n'.join([str(len(out))] + out)
sys.stdout.write(ss)


import heapq
from collections import deque
from collections import defaultdict
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline
print = sys.stdout.write
from sys import stdout
import sys
n = int(input())
bombs = []
for _ in range(n):
	x = list(map(int, input().split(' ')))
	bombs.append(x)
bombs = sorted(bombs, key=lambda x: abs(x[0]) + abs(x[1]))
out = []
for b in bombs:
	x = b
	get = []
	back = []
	if x[0] != 0:
		get.append('1 ' + str(abs(x[0])) + ' ' + ('R' if x[0] > 0 else 'L'))
		back.append('1 ' + str(abs(x[0])) + ' ' + ('L' if x[0] > 0 else 'R'))
	if x[1] != 0:
		get.append('1 ' + str(abs(x[1])) + ' ' + ('U' if x[1] > 0 else 'D'))
		back.append('1 ' + str(abs(x[1])) + ' ' + ('D' if x[1] > 0 else 'U'))
	ll = get + ['2'] + back + ['3']
	for ele in ll:
		out.append(ele)
ss = '\n'.join([str(len(out))] + out)
print(ss)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()
n = int(input())
arr = []
for i in range(n):
	li = [int(x) for x in input().split()]
	li.append(abs(li[0]) + abs(li[1]))
	arr.append(li)
arr = sorted(arr, key=lambda x: x[2])
(cx, cy) = (0, 0)
count = 0
ans = []
for ele in arr:
	(x, y) = (ele[0], ele[1])
	if x != 0:
		temp = [1]
		if x > 0:
			temp.append(x)
			temp.append('R')
		else:
			temp.append(abs(x))
			temp.append('L')
		ans.append(temp)
	if y != 0:
		temp = [1]
		if y > 0:
			temp.append(y)
			temp.append('U')
		else:
			temp.append(abs(y))
			temp.append('D')
		ans.append(temp)
	ans.append([2])
	(cx, cy) = (x, y)
	if cx != 0:
		temp = [1]
		if cx > 0:
			temp.append(cx)
			temp.append('L')
		else:
			temp.append(abs(cx))
			temp.append('R')
		ans.append(temp)
	if cy != 0:
		temp = [1]
		if cy > 0:
			temp.append(cy)
			temp.append('D')
		else:
			temp.append(abs(cy))
			temp.append('U')
		ans.append(temp)
	ans.append([3])
print(len(ans))
for ele in ans:
	print(*ele)


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))
n = int(data())
A = []
ans = []
d = dd(list)
for i in range(n):
	(x, y) = mdata()
	A.append((x, y))
A.sort(key=lambda x: abs(x[0]) + abs(x[1]))
for i in A:
	(x, y) = i
	if x > 0:
		ans.append('1 %d R' % x)
	elif x < 0:
		ans.append('1 %d L' % -x)
	if y > 0:
		ans.append('1 %d U' % y)
	elif y < 0:
		ans.append('1 %d D' % -y)
	ans.append('2')
	if x > 0:
		ans.append('1 %d L' % x)
	elif x < 0:
		ans.append('1 %d R' % -x)
	if y > 0:
		ans.append('1 %d D' % y)
	elif y < 0:
		ans.append('1 %d U' % -y)
	ans.append('3')
print(len(ans))
print('\n'.join(ans))


3

def readln():
	return tuple(map(int, input().split()))
(n,) = readln()
ans = []
for (x, y) in sorted([readln() for _ in range(n)], key=lambda x: abs(x[0]) + abs(x[1])):
	if x > 0:
		ans.append('1 %d R' % x)
	if x < 0:
		ans.append('1 %d L' % -x)
	if y > 0:
		ans.append('1 %d U' % y)
	if y < 0:
		ans.append('1 %d D' % -y)
	ans.append('2')
	if x > 0:
		ans.append('1 %d L' % x)
	if x < 0:
		ans.append('1 %d R' % -x)
	if y > 0:
		ans.append('1 %d D' % y)
	if y < 0:
		ans.append('1 %d U' % -y)
	ans.append('3')
print(len(ans))
print('\n'.join(ans))


import sys
testcases = int(input())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
arr = []
count_zero = 0
for testcase in range(testcases):
	(x, y) = get_ints()
	arr.append((x, y))
	if x == 0:
		count_zero += 1
	if y == 0:
		count_zero += 1
arr.sort(key=lambda x: abs(x[0]) + abs(x[1]))
print(6 * testcases - 2 * count_zero)
for tup in arr:
	x = tup[0]
	y = tup[1]
	if x < 0:
		print('1 ' + str(abs(x)) + ' L')
	if x > 0:
		print('1 ' + str(x) + ' R')
	if y < 0:
		print('1 ' + str(abs(y)) + ' D')
	if y > 0:
		print('1 ' + str(abs(y)) + ' U')
	print('2')
	if x < 0:
		print('1 ' + str(abs(x)) + ' R')
	if x > 0:
		print('1 ' + str(x) + ' L')
	if y < 0:
		print('1 ' + str(abs(y)) + ' U')
	if y > 0:
		print('1 ' + str(y) + ' D')
	print('3')


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
ans = []
for (x, y) in sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x: abs(x[0]) + abs(x[1])):
	if x > 0:
		ans.append('1 %d R' % x)
	if x < 0:
		ans.append('1 %d L' % -x)
	if y > 0:
		ans.append('1 %d U' % y)
	if y < 0:
		ans.append('1 %d D' % -y)
	ans.append('2')
	if x > 0:
		ans.append('1 %d L' % x)
	if x < 0:
		ans.append('1 %d R' % -x)
	if y > 0:
		ans.append('1 %d D' % y)
	if y < 0:
		ans.append('1 %d U' % -y)
	ans.append('3')
print(len(ans))
print('\n'.join(ans))