#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double err = 1e-10;
const double PI = 3.141592653589793;
const int N = 1e3 + 5;
int dp2[N][N], dp5[N][N], r = -1, c;
char dir2[N][N], dir5[N][N];
void solve() {
  int n, t;
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> t;
      if (t == 0) {
        r = i, c = j;
        dp2[i][j] = 1e9;
        dp5[i][j] = 1e9;
      }
      while (t > 0 && t % 2 == 0) {
        t /= 2;
        dp2[i][j]++;
      }
      while (t > 0 && t % 5 == 0) {
        t /= 5;
        dp5[i][j]++;
      }
      if (i - 1 >= 0 && j - 1 >= 0) {
        int mn = min(dp2[i - 1][j], dp2[i][j - 1]);
        dp2[i][j] += mn;
        if (mn == dp2[i - 1][j])
          dir2[i][j] = 'D';
        else
          dir2[i][j] = 'R';
        mn = min(dp5[i - 1][j], dp5[i][j - 1]);
        dp5[i][j] += mn;
        if (mn == dp5[i - 1][j])
          dir5[i][j] = 'D';
        else
          dir5[i][j] = 'R';
      } else if (i - 1 >= 0) {
        dp2[i][j] += dp2[i - 1][j];
        dp5[i][j] += dp5[i - 1][j];
        dir2[i][j] = dir5[i][j] = 'D';
      } else if (j - 1 >= 0) {
        dp2[i][j] += dp2[i][j - 1];
        dp5[i][j] += dp5[i][j - 1];
        dir2[i][j] = dir5[i][j] = 'R';
      }
    }
  }
  int tens = min(dp2[n - 1][n - 1], dp5[n - 1][n - 1]);
  if (r != -1 && tens > 0) {
    cout << 1 << endl;
    for (int i = 0; i < r; i++) cout << 'D';
    for (int i = 0; i < c; i++) cout << 'R';
    for (int i = r + 1; i < n; i++) cout << 'D';
    for (int i = c + 1; i < n; i++) cout << 'R';
    cout << endl;
  } else {
    cout << tens << endl;
    int i = n - 1, j = n - 1;
    string str = "";
    if (tens == dp2[n - 1][n - 1]) {
      while (i >= 0 && j >= 0) {
        str += dir2[i][j];
        if (dir2[i][j] == 'D')
          i--;
        else
          j--;
      }
      str.pop_back();
      reverse((str).begin(), (str).end());
      cout << str << endl;
    } else {
      while (i >= 0 && j >= 0) {
        str += dir5[i][j];
        if (dir5[i][j] == 'D')
          i--;
        else
          j--;
      }
      str.pop_back();
      reverse((str).begin(), (str).end());
      cout << str << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
