#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 2;
int dp[maxn][maxn][3];
int main() {
  int n;
  cin >> n;
  int x, y;
  int pos = -1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> x;
      y = x;
      if (x == 0) {
        pos = i;
        continue;
      }
      while (x % 2 == 0) {
        dp[i][j][0]++;
        x /= 2;
      }
      while (y % 5 == 0) {
        dp[i][j][1]++;
        y /= 5;
      }
    }
  }
  for (int i = 2; i <= n; i++) {
    dp[i][1][0] += dp[i - 1][1][0];
    dp[i][1][1] += dp[i - 1][1][1];
    dp[1][i][0] += dp[1][i - 1][0];
    dp[1][i][1] += dp[1][i - 1][1];
  }
  for (int i = 2; i <= n; i++) {
    for (int j = 2; j <= n; j++) {
      dp[i][j][0] += min(dp[i - 1][j][0], dp[i][j - 1][0]);
      dp[i][j][1] += min(dp[i - 1][j][1], dp[i][j - 1][1]);
    }
  }
  string str;
  int ans = dp[n][n][0] > dp[n][n][1];
  if (pos != -1 && dp[n][n][ans]) {
    cout << 1 << endl;
    for (int i = 1; i < pos; i++) cout << 'D';
    for (int i = 1; i < n; i++) cout << 'R';
    for (int i = pos; i < n; i++) cout << 'D';
    return 0;
  }
  int i = n, j = n;
  while (1) {
    if (dp[i - 1][j][ans] < dp[i][j - 1][ans]) {
      i--;
      str += "D";
    } else {
      j--;
      str += "R";
    }
    if (i == 1) {
      for (int k = 1; k < j; k++) str += "R";
      break;
    }
    if (j == 1) {
      for (int k = 1; k < i; k++) str += "D";
      break;
    }
  }
  cout << dp[n][n][ans] << endl;
  int len = str.length();
  for (int i = len - 1; i >= 0; i--) cout << str[i];
  cout << endl;
  return 0;
}
