#include <bits/stdc++.h>
using namespace std;
const int N = 32000;
const int mod = 1000000007;
const int inf = 2 * mod;
int arr[300111];
int inc[300111], decr[300111];
int combined[300111];
int n;
int dp[2][1001][1001];
bool vis[2][1001][1001];
int fx[] = {1, 0};
int fy[] = {0, 1};
int rem[2][1001][1001];
inline bool ok(int x, int y, int id) {
  if (x < n && y < n && rem[id][x][y] != -1) return true;
  return false;
}
int call(int x, int y, int id) {
  if (x == n - 1 && y == n - 1) return rem[id][x][y];
  if (vis[id][x][y]) return dp[id][x][y];
  int res = INT_MAX;
  vis[id][x][y] = 1;
  for (int i = 0; i < 2; i++) {
    int a = fx[i] + x;
    int b = fy[i] + y;
    if (ok(a, b, id)) {
      res = min(res, rem[id][x][y] + call(a, b, id));
    }
  }
  return dp[id][x][y] = res;
}
void printPath(int x, int y, int id) {
  if (x == n - 1 && y == n - 1) return;
  int pos, val = INT_MAX;
  for (int i = 0; i < 2; i++) {
    int a = fx[i] + x;
    int b = fy[i] + y;
    if (!ok(a, b, id)) continue;
    if (val > dp[id][a][b]) val = dp[id][a][b], pos = i;
  }
  if (pos == 0)
    printf("D");
  else
    printf("R");
  printPath(fx[pos] + x, fy[pos] + y, id);
}
int main() {
  scanf("%d", &n);
  int x, y;
  bool flag = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int p;
      scanf("%d", &p);
      if (!p) flag = 1, x = i, y = j, rem[0][i][j] = -1, rem[1][i][j] = -1;
      if (!p) continue;
      while (p % 2 == 0) rem[0][i][j]++, p /= 2;
      while (p % 5 == 0) rem[1][i][j]++, p /= 5;
    }
  }
  int ans = INT_MAX;
  int p = call(0, 0, 0);
  int q = call(0, 0, 1);
  int temp = (flag == 1) ? 1 : INT_MAX;
  if (min(p, q) > temp) {
    printf("1\n");
    for (int i = 0; i < x; i++) printf("D");
    for (int j = 0; j < n - 1; j++) printf("R");
    for (int i = x + 1; i < n; i++) printf("D");
    printf("\n");
  } else {
    printf("%d\n", min(p, q));
    if (p > q) {
      printPath(0, 0, 1);
    } else {
      printPath(0, 0, 0);
    }
  }
  return 0;
}
