#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> count(long long n) {
  if (n == 0) return {INT_MAX, INT_MAX};
  long long n2 = 0, n5 = 0;
  while (n > 0 && !(n & 1)) {
    ++n2;
    n >>= 1;
  }
  while (n > 0 && n % 5 == 0) {
    ++n5;
    n /= 5;
  }
  return {n2, n5};
}
void path(vector<vector<long long>> &m) {
  long long n = (long long)m.size();
  vector<vector<pair<long long, long long>>> dp(
      n, vector<pair<long long, long long>>(n));
  vector<vector<long long>> p2(n, vector<long long>(n));
  vector<vector<long long>> p5(n, vector<long long>(n));
  p2[0][0] = -1;
  p5[0][0] = -1;
  dp[0][0] = count(m[0][0]);
  for (long long i = 1; i < n; ++i) {
    pair<long long, long long> r = count(m[i][0]);
    pair<long long, long long> c = count(m[0][i]);
    dp[i][0] = {r.first + dp[i - 1][0].first, r.second + dp[i - 1][0].second};
    dp[0][i] = {c.first + dp[0][i - 1].first, c.second + dp[0][i - 1].second};
    p2[i][0] = 1;
    p2[0][i] = 2;
    p5[i][0] = 1;
    p5[0][i] = 2;
  }
  pair<long long, long long> zero = {-1, -1};
  for (long long i = 1; i < n; ++i) {
    for (long long j = 1; j < n; ++j) {
      if (m[i][j] == 0) zero = {i, j};
      pair<long long, long long> c = count(m[i][j]);
      long long t1 = c.first + dp[i - 1][j].first;
      long long t2 = c.first + dp[i][j - 1].first;
      long long f1 = c.second + dp[i - 1][j].second;
      long long f2 = c.second + dp[i][j - 1].second;
      if (t1 < t2) {
        dp[i][j] = {t1, f1};
        p2[i][j] = 1;
      } else {
        dp[i][j] = {t2, f1};
        p2[i][j] = 2;
      }
      if (f1 < f2) {
        dp[i][j].second = f1;
        p5[i][j] = 1;
      } else {
        dp[i][j].second = f2;
        p5[i][j] = 2;
      }
    }
  }
  pair<long long, long long> t = dp[n - 1][n - 1];
  long long ans = 0;
  vector<vector<long long>> par;
  if (t.first < t.second) {
    ans = t.first;
    par = p2;
  } else {
    ans = t.second;
    par = p5;
  }
  if (ans > 1 && zero != make_pair(1LL * -1, 1LL * -1)) {
    cout << 1 << "\n";
    for (long long i = 0; i < zero.second; ++i) cout << "R";
    for (long long i = 0; i < n - 1; ++i) cout << "D";
    for (long long i = zero.second + 1; i < n; ++i) cout << "R";
  } else {
    cout << ans << "\n";
    long long i = n - 1, j = n - 1;
    string pth = "";
    while (par[i][j] > 0) {
      if (par[i][j] == 2) {
        pth += 'R';
        --j;
      } else {
        pth += 'D';
        --i;
      }
    }
    reverse(pth.begin(), pth.end());
    cout << pth;
  }
  cout << "\n";
  return;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<vector<long long>> m(n, vector<long long>(n));
  for (vector<long long> &a : m)
    for (long long &b : a) cin >> b;
  path(m);
  return 0;
}
