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