#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 1001;   int dp2[MAX_N][MAX_N], dp5[MAX_N][MAX_N];   int n;   string findPath(int (*p)[MAX_N]) {     int i = n - 1, j = n - 1;     string path =   ;     while (i != 0 && j != 0) {       if (p[i - 1][j] > p[i][j - 1]) {         path.insert(0,  R );         j--;       } else {         path.insert(0,  D );         i--;       }     }     if (i == 0) {       while (j != 0) {         path.insert(0,  R );         j--;       }     } else {       while (i != 0) {         path.insert(0,  D );         i--;       }     }     return path;   }   int main() {     std::ios::sync_with_stdio(false);     cin >> n;     int temp1, temp2, zeroI = -1;     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) {         cin >> temp1;         if (!temp1) {           zeroI = i;           continue;         }         temp2 = temp1;         while (!(temp1 & 1)) {           dp2[i][j]++;           temp1 >>= 1;         }         while (!(temp2 % 5)) {           dp5[i][j]++;           temp2 /= 5;         }       }     for (int i = 1; i < n; i++) {       dp2[i][0] += dp2[i - 1][0];       dp5[i][0] += dp5[i - 1][0];       dp2[0][i] += dp2[0][i - 1];       dp5[0][i] += dp5[0][i - 1];     }     for (int i = 1; i < n; i++) {       for (int j = 1; j < n; j++) {         dp2[i][j] += min(dp2[i - 1][j], dp2[i][j - 1]);         dp5[i][j] += min(dp5[i - 1][j], dp5[i][j - 1]);       }     }     int(*p)[MAX_N] = (dp2[n - 1][n - 1] < dp5[n - 1][n - 1]) ? dp2 : dp5;     if ((~zeroI) && p[n - 1][n - 1] > 1) {       cout <<  1  << endl;       for (int i = 0; i < zeroI; i++) cout <<  D  << flush;       for (int j = 1; j < n; j++) cout <<  R  << flush;       for (int i = zeroI + 1; i < n; i++) cout <<  D  << flush;       return 0;     } else {       cout << p[n - 1][n - 1] << endl;       cout << findPath(p) << flush;     }     return 0;   }   