#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 7;
long long a[N][N];
long long d[N][N];
long long p2[N][N], p5[N][N];
pair<long long, long long> zer = {-1, -1};
void zr(long long n) {
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) d[i][j] = 0;
}
long long g(long long n, long long t) {
  if (n == 0) return 1;
  long long res = 0;
  while (n && !(n % t)) {
    res++;
    n /= t;
  }
  return res;
}
bool ex(pair<long long, long long> a) {
  return (a.first != -1 && a.second != -1);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) {
      cin >> a[i][j];
      if (a[i][j] == 0) zer = {i, j};
    }
  zr(n);
  d[0][0] = g(a[0][0], 2);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) {
      if (!i && !j) continue;
      if (i && !j) {
        d[i][j] = d[i - 1][j] + g(a[i][j], 2);
        p2[i][j] = 2;
        continue;
      }
      if (!i && j) {
        d[i][j] = d[i][j - 1] + g(a[i][j], 2);
        p2[i][j] = 1;
        continue;
      }
      if (d[i - 1][j] > d[i][j - 1]) {
        p2[i][j] = 1;
        d[i][j] = d[i][j - 1] + g(a[i][j], 2);
      } else {
        p2[i][j] = 2;
        d[i][j] = d[i - 1][j] + g(a[i][j], 2);
      }
    }
  long long opt2 = d[n - 1][n - 1];
  zr(n);
  d[0][0] = g(a[0][0], 5);
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < n; j++) {
      if (!i && !j) continue;
      if (i && !j) {
        d[i][j] = d[i - 1][j] + g(a[i][j], 5);
        p5[i][j] = 2;
        continue;
      }
      if (!i && j) {
        d[i][j] = d[i][j - 1] + g(a[i][j], 5);
        p5[i][j] = 1;
        continue;
      }
      if (d[i - 1][j] > d[i][j - 1]) {
        p5[i][j] = 1;
        d[i][j] = d[i][j - 1] + g(a[i][j], 5);
      } else {
        p5[i][j] = 2;
        d[i][j] = d[i - 1][j] + g(a[i][j], 5);
      }
    }
  long long opt5 = d[n - 1][n - 1];
  if (opt2 > 1 && opt5 > 1 && ex(zer)) {
    cout << 1 << "\n";
    for (long long i = 0; i < zer.second; i++) cout << 'R';
    for (long long i = 0; i < n - 1; i++) cout << 'D';
    for (long long i = 0; i < n - 1 - zer.second; i++) cout << 'R';
  } else if (opt2 <= opt5) {
    cout << opt2 << "\n";
    string path;
    long long ci = n - 1, cj = n - 1;
    while (ci > 0 || cj > 0) {
      if (p2[ci][cj] == 2) {
        ci--;
        path.push_back('D');
      } else if (p2[ci][cj] == 1) {
        cj--;
        path.push_back('R');
      } else {
        break;
      }
    }
    reverse(path.begin(), path.end());
    cout << path;
  } else {
    cout << opt5 << "\n";
    string path;
    long long ci = n - 1, cj = n - 1;
    while (ci > 0 || cj > 0) {
      if (p5[ci][cj] == 2) {
        ci--;
        path.push_back('D');
      } else if (p5[ci][cj] == 1) {
        cj--;
        path.push_back('R');
      } else {
        break;
      }
    }
    reverse(path.begin(), path.end());
    cout << path;
  }
}
