#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
int d[maxn][maxn][2], v[maxn][maxn][2];
int main() {
  int n, x, r = -1, c = -1;
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      cin >> x;
      if (x == 0) {
        r = i;
        c = j;
        x = 10;
      }
      while (x % 2 == 0) {
        x /= 2;
        d[i][j][0]++;
      }
      while (x % 5 == 0) {
        x /= 5;
        d[i][j][1]++;
      }
      for (int k = 0; k < 2; k++) v[i][j][k] = d[i][j][k];
    }
  for (int i = 1; i < n; i++)
    for (int j = 0; j < 2; j++) {
      d[0][i][j] += d[0][i - 1][j];
      d[i][0][j] += d[i - 1][0][j];
    }
  for (int i = 1; i < n; i++)
    for (int j = 1; j < n; j++)
      for (int k = 0; k < 2; k++)
        d[i][j][k] += min(d[i - 1][j][k], d[i][j - 1][k]);
  int k = d[n - 1][n - 1][1] < d[n - 1][n - 1][0];
  if (r != -1 && c != -1) {
    if (d[n - 1][n - 1][k] > 1) {
      cout << 1 << endl;
      for (int i = 1; i <= r; i++) cout << 'D';
      for (int j = 0; j < n - 1; j++) cout << 'R';
      for (int i = r + 1; i < n; i++) cout << 'D';
      return 0;
    }
  }
  cout << d[n - 1][n - 1][k] << endl;
  int i = n - 1, j = n - 1;
  string s = "";
  while (i != 0 || j != 0) {
    if (i > 0 && d[i - 1][j][k] + v[i][j][k] == d[i][j][k]) {
      s = 'D' + s;
      i--;
    } else {
      s = 'R' + s;
      j--;
    }
  }
  cout << s;
  return 0;
}
