#include <bits/stdc++.h>
using namespace std;
const int A = 111;
const int B = 1e6 + 11;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  return x * f;
}
char s[A][A];
int n, m, k, a[A][A], f[A][A][11], pos = 0;
struct lj {
  int dir, mod;
} ans[A][A][A];
void find(int x, int y, int mo) {
  if (x == 1)
    cout << y << '\n';
  else {
    find(x - 1, y + ans[x][y][mo].dir, ans[x][y][mo].mod);
    if (ans[x][y][mo].dir == 1)
      cout << 'L';
    else
      cout << 'R';
  }
}
int main() {
  n = read(), m = read(), k = read() + 1;
  for (int i = n; i >= 1; i--) {
    scanf("%s", s[i] + 1);
    for (int j = 1; j <= m; j++) a[i][j] = s[i][j] - '0';
  }
  memset(f, -1, sizeof(f));
  for (int i = 1; i <= m; i++) f[1][i][a[1][i] % k] = a[1][i];
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int r = 0; r < k; r++) {
        int t = (r - a[i][j] % k + k) % k;
        int val = f[i - 1][j - 1][t] + a[i][j];
        if (f[i - 1][j - 1][t] >= 0)
          if (val > f[i][j][r]) f[i][j][r] = val, ans[i][j][r] = (lj){-1, t};
        val = f[i - 1][j + 1][t] + a[i][j];
        if (f[i - 1][j + 1][t] >= 0)
          if (val > f[i][j][r]) f[i][j][r] = val, ans[i][j][r] = (lj){1, t};
      }
  for (int i = 1; i <= m; i++)
    if (f[n][i][0] > f[n][pos][0]) pos = i;
  if (!pos) return puts("-1"), 0;
  cout << f[n][pos][0] << '\n';
  find(n, pos, 0);
  return 0;
}
