#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { cin >> x; }
void _R(int64_t &x) { cin >> x; }
void _R(double &x) { cin >> x; }
void _R(long double &x) { cin >> x; }
void _R(char &x) { cin >> x; }
void _R(char *x) { cin >> x; }
void _R(string &x) { cin >> x; }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { cout << x; }
void _W(const int64_t &x) { cout << x; }
void _W(const double &x) { cout << fixed << setprecision(8) << x; }
void _W(const long double &x) { cout << fixed << setprecision(16) << x; }
void _W(const char &x) { cout << x; }
void _W(const char *x) { cout << x; }
void _W(const string &x) { cout << x; }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  cout << ' ';
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) cout << ' ';
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  cout << (sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
const int N = 1003;
int t[N][N];
int f[N][N];
int two[N][N];
int five[N][N];
int n;
bool ok(int r, int c) { return (r >= 1 && r <= n && c >= 1 && c <= n); }
pair<int, string> gett() {
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      two[i][j] = 0x3f3f3f3f;
      if (ok(i - 1, j)) {
        two[i][j] = min(two[i][j], two[i - 1][j] + t[i][j]);
      }
      if (ok(i, j - 1)) {
        two[i][j] = min(two[i][j], two[i][j - 1] + t[i][j]);
      }
      if (i == 1 && j == 1) {
        two[i][j] = t[i][j];
      }
    }
  }
  string s = "";
  int I = n, J = n;
  while (!(I == 1 && J == 1)) {
    if (ok(I - 1, J) && two[I - 1][J] + t[I][J] == two[I][J]) {
      I--;
      s += "D";
    } else if (ok(I, J - 1) && two[I][J - 1] + t[I][J] == two[I][J]) {
      J--;
      s += "R";
    }
  }
  reverse((s).begin(), (s).end());
  return {two[n][n], s};
}
pair<int, string> getf() {
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      five[i][j] = 0x3f3f3f3f;
      if (ok(i - 1, j)) {
        five[i][j] = min(five[i][j], five[i - 1][j] + f[i][j]);
      }
      if (ok(i, j - 1)) {
        five[i][j] = min(five[i][j], five[i][j - 1] + f[i][j]);
      }
      if (i == 1 && j == 1) {
        five[i][j] = f[i][j];
      }
    }
  }
  string s = "";
  int I = n, J = n;
  while (!(I == 1 && J == 1)) {
    if (ok(I - 1, J) && five[I - 1][J] + f[I][J] == five[I][J]) {
      I--;
      s += "D";
    } else if (ok(I, J - 1) && five[I][J - 1] + f[I][J] == five[I][J]) {
      J--;
      s += "R";
    }
  }
  reverse((s).begin(), (s).end());
  return {five[n][n], s};
}
void solve() {
  R(n);
  bool z_ = false;
  int z_i, z_j;
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      t[i][j] = f[i][j] = 0;
      int x;
      R(x);
      if (x == 0) {
        z_ = true;
        z_i = i;
        z_j = j;
        t[i][j] = 1;
        f[i][j] = 1;
      }
      while ((!(x & 1)) && x > 0) {
        x /= 2;
        t[i][j]++;
      }
      while (x % 5 == 0 && x > 0) {
        f[i][j]++;
        x /= 5;
      }
    }
  }
  pair<int, string> Z = {0x3f3f3f3f, "-"};
  if (z_) {
    W("");
    string D_(z_i - 1, 'D');
    string R_(z_j - 1, 'R');
    string D__(n - z_i, 'D');
    string R__(n - z_j, 'R');
    Z = {1, D_ + R_ + D__ + R__};
  }
  pair<int, string> X = gett();
  pair<int, string> Y = getf();
  if (Z.first < min(X.first, Y.first)) {
    W(Z.first);
    W(Z.second);
  } else if (X.first < Y.first) {
    W(X.first);
    W(X.second);
  } else {
    W(Y.first);
    W(Y.second);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int testcase = 1; testcase <= t; testcase++) {
    solve();
  }
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that 

  * starts in the upper left cell of the matrix; 
  * each following cell is to the right or down from the current cell; 
  * the way ends in the bottom right cell. 



Moreover, if we multiply together all the numbers along the way, the result should be the least "round". In other words, it should end in the least possible number of zeros.

Input

The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109).

Output

In the first line print the least number of trailing zeros. In the second line print the correspondent way itself.

Examples

Input

3
1 2 3
4 5 6
7 8 9


Output

0
DDRR

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { cin >> x; }
void _R(int64_t &x) { cin >> x; }
void _R(double &x) { cin >> x; }
void _R(long double &x) { cin >> x; }
void _R(char &x) { cin >> x; }
void _R(char *x) { cin >> x; }
void _R(string &x) { cin >> x; }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { cout << x; }
void _W(const int64_t &x) { cout << x; }
void _W(const double &x) { cout << fixed << setprecision(8) << x; }
void _W(const long double &x) { cout << fixed << setprecision(16) << x; }
void _W(const char &x) { cout << x; }
void _W(const char *x) { cout << x; }
void _W(const string &x) { cout << x; }
template <class T, class U>
void _W(const pair<T, U> &x) {
  _W(x.first);
  cout << ' ';
  _W(x.second);
}
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) cout << ' ';
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  cout << (sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
const int N = 1003;
int t[N][N];
int f[N][N];
int two[N][N];
int five[N][N];
int n;
bool ok(int r, int c) { return (r >= 1 && r <= n && c >= 1 && c <= n); }
pair<int, string> gett() {
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      two[i][j] = 0x3f3f3f3f;
      if (ok(i - 1, j)) {
        two[i][j] = min(two[i][j], two[i - 1][j] + t[i][j]);
      }
      if (ok(i, j - 1)) {
        two[i][j] = min(two[i][j], two[i][j - 1] + t[i][j]);
      }
      if (i == 1 && j == 1) {
        two[i][j] = t[i][j];
      }
    }
  }
  string s = "";
  int I = n, J = n;
  while (!(I == 1 && J == 1)) {
    if (ok(I - 1, J) && two[I - 1][J] + t[I][J] == two[I][J]) {
      I--;
      s += "D";
    } else if (ok(I, J - 1) && two[I][J - 1] + t[I][J] == two[I][J]) {
      J--;
      s += "R";
    }
  }
  reverse((s).begin(), (s).end());
  return {two[n][n], s};
}
pair<int, string> getf() {
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      five[i][j] = 0x3f3f3f3f;
      if (ok(i - 1, j)) {
        five[i][j] = min(five[i][j], five[i - 1][j] + f[i][j]);
      }
      if (ok(i, j - 1)) {
        five[i][j] = min(five[i][j], five[i][j - 1] + f[i][j]);
      }
      if (i == 1 && j == 1) {
        five[i][j] = f[i][j];
      }
    }
  }
  string s = "";
  int I = n, J = n;
  while (!(I == 1 && J == 1)) {
    if (ok(I - 1, J) && five[I - 1][J] + f[I][J] == five[I][J]) {
      I--;
      s += "D";
    } else if (ok(I, J - 1) && five[I][J - 1] + f[I][J] == five[I][J]) {
      J--;
      s += "R";
    }
  }
  reverse((s).begin(), (s).end());
  return {five[n][n], s};
}
void solve() {
  R(n);
  bool z_ = false;
  int z_i, z_j;
  for (int i = (1); i < (n + 1); i++) {
    for (int j = (1); j < (n + 1); j++) {
      t[i][j] = f[i][j] = 0;
      int x;
      R(x);
      if (x == 0) {
        z_ = true;
        z_i = i;
        z_j = j;
        t[i][j] = 1;
        f[i][j] = 1;
      }
      while ((!(x & 1)) && x > 0) {
        x /= 2;
        t[i][j]++;
      }
      while (x % 5 == 0 && x > 0) {
        f[i][j]++;
        x /= 5;
      }
    }
  }
  pair<int, string> Z = {0x3f3f3f3f, "-"};
  if (z_) {
    W("");
    string D_(z_i - 1, 'D');
    string R_(z_j - 1, 'R');
    string D__(n - z_i, 'D');
    string R__(n - z_j, 'R');
    Z = {1, D_ + R_ + D__ + R__};
  }
  pair<int, string> X = gett();
  pair<int, string> Y = getf();
  if (Z.first < min(X.first, Y.first)) {
    W(Z.first);
    W(Z.second);
  } else if (X.first < Y.first) {
    W(X.first);
    W(X.second);
  } else {
    W(Y.first);
    W(Y.second);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int testcase = 1; testcase <= t; testcase++) {
    solve();
  }
  return 0;
}

```