#include <bits/stdc++.h>
using namespace std;
int f[105][105][15], n, m, k, mat[105][105];
char s[105];
inline int mod(const int &x) { return (x % k + k) % k; }
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    for (int j = 0; j < m; ++j) mat[i][j] = s[j] - 0x30;
  }
  memset(f, 0x80, sizeof(f));
  ++k;
  for (int j = 0; j < m; ++j) f[n - 1][j][mod(mat[n - 1][j])] = mat[n - 1][j];
  for (int i = n - 2; i >= 0; --i) {
    for (int j = 0; j < m; ++j) {
      for (int r = 0; r < k; ++r) {
        if (j > 0)
          f[i][j][r] =
              max(f[i][j][r], f[i + 1][j - 1][mod(r - mat[i][j])] + mat[i][j]);
        if (j < m - 1)
          f[i][j][r] =
              max(f[i][j][r], f[i + 1][j + 1][mod(r - mat[i][j])] + mat[i][j]);
      }
    }
  }
  int pos = 0, mx = f[0][0][0];
  for (int j = 1; j < m; ++j)
    if (f[0][j][0] > mx) mx = f[0][j][0], pos = j;
  if (mx < 0)
    cout << "-1\n";
  else {
    memset(s, 0, sizeof(s));
    cout << mx << "\n";
    for (int i = 0, j = pos; i < n; ++i) {
      mx -= mat[i][j];
      if (i == n - 1)
        cout << j + 1 << "\n";
      else if (j == 0 || j != m - 1 && f[i][j][mod(mx + mat[i][j])] ==
                                           f[i + 1][j + 1][mod(mx)] + mat[i][j])
        s[n - i - 2] = 'L', ++j;
      else
        s[n - i - 2] = 'R', --j;
    }
    printf("%s", s);
  }
  return 0;
}
