#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e3 + 3;
int dp[maxn][maxn][2];
int path[maxn][maxn][2];
int cal(int num, int typ) {
  int tim = 0;
  int bynum = typ == 0 ? 2 : 5;
  while (!(num % bynum)) {
    num /= bynum;
    tim++;
  }
  return tim;
}
void fuck(int x, int y, int k) {
  if (x == 1 && y == 1) return;
  if (path[x][y][k] == 1) {
    fuck(x - 1, y, k), putchar('D');
  } else {
    fuck(x, y - 1, k), putchar('R');
  }
}
int main() {
  int num, ori;
  bool flag = false;
  int onei, onej;
  memset(dp, 0, sizeof(dp));
  scanf("%d", &num);
  for (int i = 2; i <= num; i++) {
    dp[i][0][0] = dp[0][i][0] = dp[i][0][1] = dp[0][i][1] = 0x3f3f3f3f;
  }
  for (int i = 1; i <= num; i++) {
    for (int j = 1; j <= num; j++) {
      scanf("%d", &ori);
      if (!ori)
        flag = true, onei = i, onej = j;
      else {
        while (ori % 2 == 0) dp[i][j][0]++, ori /= 2;
        while (ori % 5 == 0) dp[i][j][1]++, ori /= 5;
      }
      for (int k = 0; k < 2; k++) {
        if (dp[i - 1][j][k] < dp[i][j - 1][k])
          dp[i][j][k] += dp[i - 1][j][k], path[i][j][k] = 1;
        else
          dp[i][j][k] += dp[i][j - 1][k], path[i][j][k] = 2;
      }
    }
  }
  int kk = dp[num][num][0] > dp[num][num][1] ? 1 : 0;
  int i;
  if (flag && dp[num][num][kk] > 1) {
    cout << "1\n";
    for (i = 2; i <= onei; i++) putchar('D');
    for (i = 2; i <= num; i++) putchar('R');
    for (i = onei + 1; i <= num; i++) putchar('D');
    return 0;
  }
  printf("%d\n", dp[num][num][kk]);
  fuck(num, num, kk);
  printf("\n");
  return 0;
}
