#include <bits/stdc++.h>
int p2[1002][1002], p5[1002][1002];
char s2[1002][1002], s5[1002][1002], route[1002 << 1];
int n, ans, k, cnt, x, flx, fly;
bool flag, kkk;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  x *= f;
}
int main() {
  read(n);
  for (register int i = 0; i <= n; ++i)
    p2[0][i] = p2[i][0] = p5[0][i] = p5[i][0] = 0x3f3f3f3f;
  p2[0][1] = p5[0][1] = 0;
  for (register int i = 1; i <= n; ++i)
    for (register int j = 1; j <= n; ++j) {
      cnt = 0;
      read(x);
      if (x == 0) {
        kkk = 1, flx = i, fly = j;
        p2[i][j] = 1, s2[i][j] = 'D';
        p5[i][j] = 1, s5[i][j] = 'D';
        continue;
      }
      k = x;
      while (x % 2 == 0) ++cnt, x /= 2;
      if (p2[i - 1][j] >= p2[i][j - 1])
        p2[i][j] = p2[i][j - 1] + cnt, s2[i][j] = 'R';
      else
        p2[i][j] = p2[i - 1][j] + cnt, s2[i][j] = 'D';
      cnt = 0;
      while (k % 5 == 0) ++cnt, k /= 5;
      if (p5[i - 1][j] >= p5[i][j - 1])
        p5[i][j] = p5[i][j - 1] + cnt, s5[i][j] = 'R';
      else
        p5[i][j] = p5[i - 1][j] + cnt, s5[i][j] = 'D';
    }
  if (p2[n][n] > p5[n][n])
    ans = p5[n][n], flag = true;
  else
    ans = p2[n][n];
  cnt = 0;
  if (kkk && ans) {
    int i = flx, j = fly;
    puts("1");
    while (!(i == 1 && j == 1)) {
      if (s2[i][j] == 'R')
        route[++cnt] = 'R', --j;
      else if (s2[i][j] == 'D')
        route[++cnt] = 'D', --i;
      else
        break;
    }
    for (register int i = cnt; i >= 1; --i) printf("%c", route[i]);
    while (flx != n) ++flx, printf("D");
    while (fly != n) ++fly, printf("R");
    return 0;
  }
  printf("%d\n", ans);
  int i = n, j = n;
  if (flag)
    while (!(i == 1 && j == 1)) {
      if (s5[i][j] == 'R')
        route[++cnt] = 'R', --j;
      else if (s5[i][j] == 'D')
        route[++cnt] = 'D', --i;
      else
        break;
    }
  else
    while (!(i == 1 && j == 1)) {
      if (s2[i][j] == 'R')
        route[++cnt] = 'R', --j;
      else if (s2[i][j] == 'D')
        route[++cnt] = 'D', --i;
      else
        break;
    }
  for (register int i = cnt; i >= 1; --i) printf("%c", route[i]);
  return 0;
}
