#include <bits/stdc++.h>
using namespace std;
int grid[1100][1100];
int min2[1100][1100];
int min5[1100][1100];
char path2[1100][1100];
char path5[1100][1100];
int N;
int ZERO = 0;
pair<int, int> zeroPos;
int main() {
  scanf("%d", &N);
  memset(grid, 0, sizeof(grid));
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) {
      int a;
      scanf("%d", &a);
      while (a != 0 && a % 2 == 0) a /= 2, grid[i][j]++;
      while (a != 0 && a % 5 == 0) a /= 5, grid[i][j] += 100;
      if (a == 0) {
        ZERO = 1;
        zeroPos.first = i;
        zeroPos.second = j;
        grid[i][j]++;
        grid[i][j] += 100;
      }
    }
  memset(min2, 0, sizeof(min2));
  for (int j = N - 1; j >= 0; j--)
    for (int i = N - 1; i >= 0; i--) {
      if (i == N - 1 && i == j) {
        min2[i][j] = grid[i][j] % 100;
        continue;
      }
      int down, right;
      if (i == N - 1)
        down = 2147483647;
      else
        down = min2[i + 1][j];
      if (j == N - 1)
        right = 2147483647;
      else
        right = min2[i][j + 1];
      if (down < right) {
        path2[i][j] = 'D';
        min2[i][j] = (grid[i][j] % 100) + down;
      } else {
        path2[i][j] = 'R';
        min2[i][j] = (grid[i][j] % 100) + right;
      }
    }
  memset(min5, 0, sizeof(min5));
  for (int j = N - 1; j >= 0; j--)
    for (int i = N - 1; i >= 0; i--) {
      if (i == N - 1 && i == j) {
        min5[i][j] = grid[i][j] / 100;
        continue;
      }
      int down, right;
      if (i == N - 1)
        down = 2147483647;
      else
        down = min5[i + 1][j];
      if (j == N - 1)
        right = 2147483647;
      else
        right = min5[i][j + 1];
      if (down < right) {
        path5[i][j] = 'D';
        min5[i][j] = (grid[i][j] / 100) + down;
      } else {
        path5[i][j] = 'R';
        min5[i][j] = (grid[i][j] / 100) + right;
      }
    }
  int num5 = 0, num2 = 0;
  int sX = 0, sY = 0;
  char s2[1100 + 1100];
  int i = 0;
  while (sX != N - 1 || sY != N - 1) {
    s2[i++] = path2[sX][sY];
    num5 += grid[sX][sY] / 100;
    num2 += grid[sX][sY] % 100;
    if (path2[sX][sY] == 'D')
      sX++;
    else
      sY++;
  }
  s2[i] = 0;
  num5 += grid[sX][sY] / 100;
  num2 += grid[sX][sY] % 100;
  int round2 = min(num5, num2);
  num5 = num2 = 0;
  sX = sY = 0;
  char s5[1100 + 1100];
  i = 0;
  while (sX != N - 1 || sY != N - 1) {
    s5[i++] = path5[sX][sY];
    num5 += grid[sX][sY] / 100;
    num2 += grid[sX][sY] % 100;
    if (path5[sX][sY] == 'D')
      sX++;
    else
      sY++;
  }
  s5[i] = 0;
  num5 += grid[sX][sY] / 100;
  num2 += grid[sX][sY] % 100;
  if (min(num5, num2) < round2 && (min(num5, num2) < ZERO || ZERO == 0)) {
    printf("%d\n", min(num5, num2));
    printf("%s\n", s5);
  } else if (round2 < ZERO || ZERO == 0) {
    printf("%d\n", round2);
    printf("%s\n", s2);
  } else {
    printf("1\n");
    for (int i = 0; i < zeroPos.second; i++) printf("R");
    for (int i = 0; i < N - 1; i++) printf("D");
    for (int i = 0; i < N - zeroPos.second - 1; i++) printf("R");
    printf("\n");
  }
  return 0;
}
