#include <bits/stdc++.h>
using namespace std;
int n;
int dp[2][1005][1005];
int path[2][1005][1005];
int div2[] = {2, 5};
int in[1005][1005];
int factor(int x, int d) {
  if (x == 0) return -1;
  int cnt = 0;
  while (x % d == 0) {
    x /= d;
    cnt++;
  }
  return cnt;
}
void show(int ind, int ii, int jj) {
  if (ii != 1 || jj != 1) {
    if (path[ind][ii][jj] == 1) {
      show(ind, ii - 1, jj);
      printf("D");
    } else {
      show(ind, ii, jj - 1);
      printf("R");
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[0][i][j] = dp[1][i][j] = 100000000;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &in[i][j]);
      for (int k = 0; k < 2; k++) dp[k][i][j] = factor(in[i][j], div2[k]);
    }
  }
  for (int k = 0; k < 2; k++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        if (i == 1 && j == 1) continue;
        if (in[i][j] == 0) {
          dp[k][i][j] = -100000000;
          if (dp[k][i - 1][j] > dp[k][i][j - 1])
            path[k][i][j] = 2;
          else
            path[k][i][j] = 1;
        } else if (dp[k][i - 1][j] && dp[k][i - 1][j] > dp[k][i][j - 1]) {
          dp[k][i][j] += dp[k][i][j - 1];
          path[k][i][j] = 2;
        } else {
          dp[k][i][j] += dp[k][i - 1][j];
          path[k][i][j] = 1;
        }
      }
    }
  }
  if (dp[0][n][n] == 0) {
    printf("0\n");
    show(0, n, n);
  } else if (dp[1][n][n] == 0) {
    printf("0\n");
    show(1, n, n);
  } else if (dp[1][n][n] < dp[0][n][n]) {
    if (dp[1][n][n] < 0)
      printf("1\n");
    else
      printf("%d\n", dp[1][n][n]);
    show(1, n, n);
  } else {
    if (dp[0][n][n] < 0)
      printf("1\n");
    else
      printf("%d\n", dp[0][n][n]);
    show(0, n, n);
  }
  printf("\n");
  return 0;
}
