#include <bits/stdc++.h>
using namespace std;
int h, w;
int a[2][1005][1005];
int dp[2][1005][1005], path[2][1005][1005];
int main() {
  int i, j, t;
  bool zero = false;
  int zerox = -1, zeroy = -1;
  scanf("%d", &h);
  w = h;
  for ((i) = 0; (i) < (int)(h); (i)++)
    for ((j) = 0; (j) < (int)(w); (j)++) {
      int x;
      scanf("%d", &x);
      if (!x) {
        a[0][i][j] = a[1][i][j] = 1;
        zero = true;
        zerox = i;
        zeroy = j;
      } else {
        while (x % 2 == 0) {
          a[0][i][j]++;
          x /= 2;
        }
        while (x % 5 == 0) {
          a[1][i][j]++;
          x /= 5;
        }
      }
    }
  for ((t) = 0; (t) < (int)(2); (t)++)
    for ((i) = 0; (i) < (int)(h); (i)++)
      for ((j) = 0; (j) < (int)(w); (j)++) {
        int ans = (1 << 29);
        if (i == 0 && j == 0) ans = 0;
        if (i != 0 && dp[t][i - 1][j] < ans) ans = dp[t][i - 1][j];
        if (j != 0 && dp[t][i][j - 1] < ans) {
          ans = dp[t][i][j - 1];
          path[t][i][j] = 1;
        }
        dp[t][i][j] = ans + a[t][i][j];
      }
  t = 0;
  if (dp[1][h - 1][w - 1] < dp[0][h - 1][w - 1]) t = 1;
  if (dp[t][h - 1][w - 1] > 1 && zero) {
    string s;
    for ((i) = 0; (i) < (int)(zerox); (i)++) s += 'D';
    for ((i) = 0; (i) < (int)(zeroy); (i)++) s += 'R';
    for ((i) = 0; (i) < (int)(h - 1 - zerox); (i)++) s += 'D';
    for ((i) = 0; (i) < (int)(w - 1 - zeroy); (i)++) s += 'R';
    cout << 1 << endl << s << endl;
  } else {
    i = h - 1;
    j = w - 1;
    string s;
    while (i > 0 || j > 0) {
      if (path[t][i][j] == 0) {
        i--;
        s += 'D';
      } else {
        j--;
        s += 'R';
      }
    }
    reverse(s.begin(), s.end());
    cout << dp[t][h - 1][w - 1] << endl << s << endl;
  }
  return 0;
}
