Innoforest

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Trees in Innopolis are exceptional, if you water an innotree (Innopolis Tree), it will grow by number of litres you have watered it. In other words if you water innotree of height hh by xx litres of water then it will have new height of h+xh + x.

Innoforest (Innopolis Forest) is a n×mn \times m grid, each cell of the grid contains one innotree. Irrigation system in innoforest contains n+mn + m canals: one for each row and column. The irrigation system in one operation can water all trees along one of canals by the same amount of water.

The mayor of Innopolis wants to transform the innoforest by performing some operations on the irrigation system. For each tree in innoforest you know its current height and the desired height. Your task is to find the sequence of operations that transforms the innoforest to the desired shape.

입력

First line contains two numbers nn and mm (1n,m10001 \le n, m \le 1000).

Then nn lines follow, each line contains mm numbers a_i,ja\_{i,j}, current heights of the trees in innoforest (1a_i,j1091 \le a\_{i,j} \le 10^9).

Then nn more lines follow, each line contains mm numbers b_i,jb\_{i,j}, desired heights of the trees (1b_i,j1091 \le b\_{i,j} \le 10^9).

출력

The first line should contain the number of operations kk (0k1060 \le k \le 10^6), then kk lines contain the description of operations.

  • "R r x" The system will water the rr-th row by xx litres. (1rn1 \le r \le n, 1x1091 \le x \le 10^9).
  • "C c x" The system will water the cc-th column by xx litres. (1cm1 \le c \le m, 1x1091 \le x \le 10^9).

If it is impossible to transform the innoforest to the desired shape, output only one integer -1.

Notice that it is not required to minimize the number of operations, only make sure that it does not exceed 10610^6.