#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int n, arr[N][N], dp[6][N][N];
char sol[6][N][N];
int main() {
  scanf("%d", &n);
  int f = 0, ii = -1, jj = -1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &arr[i][j]);
      if (arr[i][j] == 0) {
        f = 1;
        ii = i;
        jj = j;
      } else {
        int x = arr[i][j];
        while (x % 2 == 0) {
          dp[2][i][j]++;
          x /= 2;
        }
        while (x % 5 == 0) {
          dp[5][i][j]++;
          x /= 5;
        }
      }
      if (i == 1 && j == 1) continue;
      int tmp1 = INT_MAX, tmp2 = INT_MAX;
      if (i != 1) {
        sol[2][i][j] = 'D';
        tmp1 = dp[2][i - 1][j];
        sol[5][i][j] = 'D';
        tmp2 = dp[5][i - 1][j];
      }
      if (j != 1) {
        if (dp[2][i][j - 1] < tmp1) {
          tmp1 = dp[2][i][j - 1];
          sol[2][i][j] = 'R';
        }
        if (dp[5][i][j - 1] < tmp2) {
          tmp2 = dp[5][i][j - 1];
          sol[5][i][j] = 'R';
        }
      }
      dp[2][i][j] += tmp1;
      dp[5][i][j] += tmp2;
    }
  }
  int num = 0;
  if (!f || (f && (!dp[2][n][n] || !dp[5][n][n]))) {
    if (dp[2][n][n] < dp[5][n][n])
      num = 2;
    else
      num = 5;
    cout << dp[num][n][n] << endl;
    int i = n, j = n;
    string s = "";
    while (i != 1 || j != 1) {
      s += sol[num][i][j];
      if (sol[num][i][j] == 'D')
        i--;
      else
        j--;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
  } else {
    cout << "1\n";
    for (int i = 0; i < ii - 1; i++) printf("D");
    for (int i = 0; i < n - 1; i++) printf("R");
    for (int i = 0; i < n - ii; i++) printf("D");
  }
  return 0;
}
