#include <bits/stdc++.h>
using namespace std;
int divs(int n, int d) {
  int res = 0;
  while (n % d == 0) {
    res++;
    n /= d;
  }
  return res;
}
int main() {
  int n, v, zi = 0, zj = 0;
  scanf("%d", &n);
  vector<vector<int> > l[2][2];
  vector<int> ini(2, 1000000);
  char path[2][1001][1001];
  l[0][0].resize(n + 1, ini);
  l[0][1].resize(n + 1, ini);
  l[1][0].resize(n + 1, ini);
  l[1][1].resize(n + 1, ini);
  vector<int> ini0(2, 0);
  l[0][0][1] = l[0][1][0] = l[1][0][1] = l[1][1][0] = ini0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      scanf("%d", &v);
      if (v == 0) {
        l[0][1][j][0] = l[0][1][j][1] = l[1][1][j][0] = l[1][1][j][1] = 1000000;
        path[0][i][j] = path[1][i][j] = 'R';
        zi = i;
        zj = j;
        continue;
      }
      int d[] = {divs(v, 2), divs(v, 5)};
      for (int k = 0; k < 2; ++k) {
        if (l[k][0][j][k] < l[k][1][j - 1][k]) {
          l[k][1][j][0] = l[k][0][j][0] + d[0];
          l[k][1][j][1] = l[k][0][j][1] + d[1];
          path[k][i][j] = 'D';
        } else {
          l[k][1][j][0] = l[k][1][j - 1][0] + d[0];
          l[k][1][j][1] = l[k][1][j - 1][1] + d[1];
          path[k][i][j] = 'R';
        }
      }
    }
    l[0][0].swap(l[0][1]);
    l[1][0].swap(l[1][1]);
    l[0][1][0] = l[1][1][0] = ini;
  }
  int z2 = min(l[0][0][n][0], l[0][0][n][1]);
  int z5 = min(l[1][0][n][0], l[1][0][n][1]);
  int zeroes = min(z2, z5);
  if ((zeroes > 0) && (zi > 0)) {
    printf("1\n");
    for (int i = 2; i <= zi; ++i) printf("D");
    for (int j = 2; j <= zj; ++j) printf("R");
    for (int i = zi + 1; i <= n; ++i) printf("D");
    for (int j = zj + 1; j <= n; ++j) printf("R");
  } else {
    int k = (z2 < z5) ? 0 : 1;
    int i = n, j = n;
    int p = 2 * n - 2;
    string res(p, ' ');
    while (--p >= 0) {
      res[p] = path[k][i][j];
      if (res[p] == 'D')
        i--;
      else
        j--;
    }
    printf("%d\n%s", zeroes, res.c_str());
  }
  return 0;
}
