Codeforces Beta Round 2 |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

dp

math

*2000

No tag edit access

The problem statement has recently been changed. View the changes.

×
B. The least round way

time limit per test

2 secondsmemory limit per test

64 megabytesinput

standard inputoutput

standard outputThere is a square matrix *n* × *n*, consisting of non-negative integer numbers. You should find such a way on it that

- starts in the upper left cell of the matrix;
- each following cell is to the right or down from the current cell;
- the way ends in the bottom right cell.

Moreover, if we multiply together all the numbers along the way, the result should be the least "round". In other words, it should end in the least possible number of zeros.

Input

The first line contains an integer number *n* (2 ≤ *n* ≤ 1000), *n* is the size of the matrix. Then follow *n* lines containing the matrix elements (non-negative integer numbers not exceeding 10^{9}).

Output

In the first line print the least number of trailing zeros. In the second line print the correspondent way itself.

Examples

Input

3

1 2 3

4 5 6

7 8 9

Output

0

DDRR

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/29/2023 19:21:08 (k1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|