#include <bits/stdc++.h>
using namespace std;
char ans[2 * 1001];
bool zero_have;
int x, i, j, k, n, l, zero_row, a[1001][1001][2];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      scanf("%d", &x);
      if (!x) {
        x = 10;
        zero_have = 1;
        zero_row = i;
      }
      while (x % 2 == 0) a[i][j][0]++, x /= 2;
      while (x % 5 == 0) a[i][j][1]++, x /= 5;
    }
  for (i = 0; i <= n; i++)
    a[0][i][0] = a[0][i][1] = a[i][0][0] = a[i][0][1] = (1 << 30);
  for (i = 2; i <= n; i++) {
    a[1][i][0] += a[1][i - 1][0];
    a[1][i][1] += a[1][i - 1][1];
    a[i][1][0] += a[i - 1][1][0];
    a[i][1][1] += a[i - 1][1][1];
  }
  for (i = 2; i <= n; i++)
    for (j = 2; j <= n; j++) {
      a[i][j][0] += min(a[i - 1][j][0], a[i][j - 1][0]);
      a[i][j][1] += min(a[i - 1][j][1], a[i][j - 1][1]);
    }
  k = a[n][n][0] > a[n][n][1];
  if (zero_have && a[n][n][k]) {
    printf("1\n");
    for (i = 1; i < zero_row; i++) printf("D");
    for (i = 1; i < n; i++) printf("R");
    for (i = zero_row; i < n; i++) printf("D");
  } else {
    i = j = n;
    while (i != 1 || j != 1) {
      if (a[i - 1][j][k] < a[i][j - 1][k]) {
        i--;
        ans[++l] = 'D';
      } else {
        j--;
        ans[++l] = 'R';
      }
    }
    printf("%d\n", a[n][n][k]);
    for (i = l; i > 0; i--) printf("%c", ans[i]);
  }
}
