#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int dp2[N][N];
int dp5[N][N];
int board2[N][N];
int board5[N][N];
bool p[2][N][N];
pair<int, int> iszero;
int n;
inline void solve() {
  dp2[0][0] = board2[0][0];
  dp5[0][0] = board5[0][0];
  for (int i = int(1); i < int(n); ++i) {
    dp2[0][i] = dp2[0][i - 1] + board2[0][i];
    p[0][0][i] = false;
    dp5[0][i] = dp5[0][i - 1] + board5[0][i];
    p[1][0][i] = false;
  }
  for (int i = int(1); i < int(n); ++i) {
    dp2[i][0] = dp2[i - 1][0] + board2[i][0];
    p[0][i][0] = true;
    dp5[i][0] = dp5[i - 1][0] + board5[i][0];
    p[1][i][0] = true;
  }
  for (int i = int(1); i < int(n); ++i)
    for (int j = int(1); j < int(n); ++j) {
      dp2[i][j] = board2[i][j];
      dp5[i][j] = board5[i][j];
      if (dp2[i - 1][j] < dp2[i][j - 1]) {
        dp2[i][j] += dp2[i - 1][j];
        p[0][i][j] = true;
      } else {
        dp2[i][j] += dp2[i][j - 1];
        p[0][i][j] = false;
      }
      if (dp5[i - 1][j] < dp5[i][j - 1]) {
        dp5[i][j] += dp5[i - 1][j];
        p[1][i][j] = true;
      } else {
        dp5[i][j] += dp5[i][j - 1];
        p[1][i][j] = false;
      }
    }
}
inline void find_path(int u) {
  string s;
  int i = n - 1, j = n - 1;
  if (u)
    cout << dp5[i][j] << endl;
  else
    cout << dp2[i][j] << endl;
  while (i != 0 || j != 0) {
    if (p[u][i][j])
      s.push_back('D'), i--;
    else
      s.push_back('R'), j--;
  }
  reverse((s).begin(), (s).end());
  cout << s << endl;
}
inline void find_special_path() {
  string s;
  int i = 0, j = 0;
  while (i < iszero.first) s.push_back('D'), i++;
  while (j < iszero.second) s.push_back('R'), j++;
  while (i < n - 1) s.push_back('D'), i++;
  while (j < n - 1) s.push_back('R'), j++;
  cout << s << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  iszero = {-1, -1};
  for (int i = int(0); i < int(n); ++i)
    for (int j = int(0); j < int(n); ++j) {
      int k;
      cin >> k;
      if (k == 0) {
        iszero = {i, j};
        board2[i][j] = 1;
        board5[i][j] = 1;
        continue;
      }
      while (k % 2 == 0) board2[i][j]++, k /= 2;
      while (k % 5 == 0) board5[i][j]++, k /= 5;
    }
  solve();
  if (iszero == pair<int, int>(-1, -1)) {
    if (dp2[n - 1][n - 1] < dp5[n - 1][n - 1])
      find_path(0);
    else
      find_path(1);
  } else {
    int val = min(dp2[n - 1][n - 1], dp5[n - 1][n - 1]);
    if (val == 0) {
      if (dp2[n - 1][n - 1] < dp5[n - 1][n - 1])
        find_path(0);
      else
        find_path(1);
    } else {
      cout << 1 << endl;
      find_special_path();
    }
  }
  return 0;
}
