#include <bits/stdc++.h>
using namespace std;
vector<long long> factors;
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
template <typename T>
int BS(vector<T> &mas, T val) {
  int l, r;
  l = 0;
  r = mas.size() - 1;
  while (r - l > 1) {
    int mid = l + (r - l) / 2;
    if (mas[mid] < val) {
      l = mid;
    } else
      r = mid;
  }
  if (mas[r] == val) return r;
  if (mas[l] == val) return l;
  return -1;
}
template <typename T>
int UBS(vector<T> &mas, T val) {
  int l, r;
  l = 0;
  r = mas.size() - 1;
  while (r - l > 1) {
    int mid = l + (r - l) / 2;
    if (mas[mid] < val) {
      l = mid;
    } else
      r = mid;
  }
  if (mas[l] >= val) return l;
  if (mas[r] >= val) return r;
  return -1;
}
long long mod(long long a, long long m) {
  return (a + (abs(a) / m) * m + m) % m;
}
struct elem {
  long long col5;
  long long col2;
  long long m5 = LL_INF;
  long long m2 = LL_INF;
  char from5;
  char from2;
};
vector<vector<elem>> matr52;
vector<vector<long long>> matr;
long long count2(long long n) {
  long long res = 0;
  if (n == 0) return 0;
  while (n % 2 == 0) {
    ++res;
    n /= 2;
  }
  return res;
}
long long count5(long long n) {
  long long res = 0;
  if (n == 0) return 0;
  while (n % 5 == 0) {
    ++res;
    n /= 5;
  }
  return res;
}
long long dp2(long long i, long long j) {
  if (matr52[i][j].m2 == LL_INF) {
    if (i && j) {
      long long t1 = dp2(i - 1, j) + matr52[i][j].col2;
      long long t2 = dp2(i, j - 1) + matr52[i][j].col2;
      if (t1 < t2) {
        matr52[i][j].m2 = t1;
        matr52[i][j].from2 = 'D';
      } else {
        matr52[i][j].m2 = t2;
        matr52[i][j].from2 = 'R';
      }
    } else if (i) {
      matr52[i][j].m2 = dp2(i - 1, j) + matr52[i][j].col2;
      matr52[i][j].from2 = 'D';
    } else if (j) {
      matr52[i][j].m2 = dp2(i, j - 1) + matr52[i][j].col2;
      matr52[i][j].from2 = 'R';
    } else {
      return matr52[0][0].m2;
    }
  }
  return matr52[i][j].m2;
}
long long dp5(long long i, long long j) {
  if (matr52[i][j].m5 == LL_INF) {
    if (i && j) {
      long long t1 = dp5(i - 1, j) + matr52[i][j].col5;
      long long t2 = dp5(i, j - 1) + matr52[i][j].col5;
      if (t1 < t2) {
        matr52[i][j].m5 = t1;
        matr52[i][j].from5 = 'D';
      } else {
        matr52[i][j].m5 = t2;
        matr52[i][j].from5 = 'R';
      }
    } else if (i) {
      matr52[i][j].m5 = dp5(i - 1, j) + matr52[i][j].col5;
      matr52[i][j].from5 = 'D';
    } else if (j) {
      matr52[i][j].m5 = dp5(i, j - 1) + matr52[i][j].col5;
      matr52[i][j].from5 = 'R';
    } else {
      return matr52[0][0].m5;
    }
  }
  return matr52[i][j].m5;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  long long n;
  cin >> n;
  matr.assign(n, vector<long long>(n));
  matr52.assign(n, vector<elem>(n));
  bool checkz = false;
  long long zi, zj;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> matr[i][j];
      if (matr[i][j] == 0) {
        checkz = true;
        zi = i;
        zj = j;
      }
      matr52[i][j].col2 = count2(matr[i][j]);
      matr52[i][j].col5 = count5(matr[i][j]);
    }
  }
  matr52[0][0].m2 = matr52[0][0].col2;
  matr52[0][0].m5 = matr52[0][0].col5;
  long long t1 = dp2(n - 1, n - 1);
  long long t2 = dp5(n - 1, n - 1);
  if (t1 && t2 && checkz) {
    cout << 1 << '\n';
    for (int i = 0; i < zj; ++i) {
      cout << "R";
    }
    for (int i = 0; i < n - 1; ++i) {
      cout << "D";
    }
    for (int i = zj; i < n - 1; ++i) {
      cout << 'R';
    }
    return 0;
  }
  if (t1 < t2) {
    cout << t1 << '\n';
    vector<char> ans;
    int i, j;
    i = n - 1;
    j = n - 1;
    while (i || j) {
      ans.push_back(matr52[i][j].from2);
      if (matr52[i][j].from2 == 'D')
        --i;
      else
        --j;
    }
    reverse((ans).begin(), (ans).end());
    for (auto i : ans) cout << i;
  } else {
    cout << t2 << '\n';
    vector<char> ans;
    int i, j;
    i = n - 1;
    j = n - 1;
    while (i || j) {
      ans.push_back(matr52[i][j].from5);
      if (matr52[i][j].from5 == 'D')
        --i;
      else
        --j;
    }
    reverse((ans).begin(), (ans).end());
    for (auto i : ans) cout << i;
  }
  return 0;
}
