#include <bits/stdc++.h>
using namespace std;
int k = -1, f[1005][1005][2], q, n;
bool b[1005][1005][2];
void print(int x, int y) {
  if (x == 1 && y == 1) {
    return;
  }
  if (b[x][y][q] == 0) {
    print(x, y - 1);
    cout << 'R';
  } else {
    print(x - 1, y);
    cout << 'D';
  }
}
int main() {
  int i, j, t;
  cin >> n;
  for (i = 2; i <= n; i++) {
    f[i][0][0] = f[0][i][0] = f[i][0][1] = f[0][i][1] = 1000100101;
  }
  for (j = 1; j <= n; j++) {
    for (t = 1; t <= n; t++) {
      int p;
      cin >> p;
      if (p == 0)
        k = j;
      else {
        while (p % 2 == 0) {
          f[j][t][0]++;
          p /= 2;
        }
        while (p % 5 == 0) {
          f[j][t][1]++;
          p /= 5;
        }
      }
      for (i = 0; i < 2; i++) {
        if (f[j - 1][t][i] < f[j][t - 1][i]) {
          f[j][t][i] += f[j - 1][t][i];
          b[j][t][i] = 1;
        } else {
          f[j][t][i] += f[j][t - 1][i];
          b[j][t][i] = 0;
        }
      }
    }
  }
  q = 0;
  if (f[n][n][0] > f[n][n][1]) q = 1;
  if (k != -1 && f[n][n][q] > 1) {
    cout << "1\n";
    for (i = 1; i < k; i++) cout << 'D';
    for (i = 1; i < n; i++) cout << 'R';
    for (i = k; i < n; i++) cout << 'D';
    return 0;
  }
  cout << f[n][n][q] << '\n';
  print(n, n);
  return 0;
}
