#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int maxn = 2e2 + 5;
int a[maxn][maxn], f[maxn][maxn][11];
char s[maxn], Ans[maxn];
int stp, n, m, k;
void solve(int i, int j, int o) {
  if (i == n) {
    stp = j;
    return;
  }
  if (j - 1 >= 1 &&
      f[i][j][o] == f[i + 1][j - 1][((o - a[i][j]) % k + k) % k] + a[i][j])
    Ans[i] = 'R', solve(i + 1, j - 1, ((o - a[i][j]) % k + k) % k);
  else if (j + 1 <= m &&
           f[i][j][o] == f[i + 1][j + 1][((o - a[i][j]) % k + k) % k] + a[i][j])
    Ans[i] = 'L', solve(i + 1, j + 1, ((o - a[i][j]) % k + k) % k);
}
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  k++;
  for (int i = (1); i <= (n); i++) {
    scanf("%s", s + 1);
    for (int j = (1); j <= (m); j++) a[i][j] = s[j] - '0';
  }
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++)
      for (int o = (0); o <= (k - 1); o++) f[i][j][o] = -1e9;
  for (int i = (1); i <= (m); i++) f[n][i][a[n][i] % k] = a[n][i];
  for (int i = (n); i >= (1); i--)
    for (int j = (1); j <= (m); j++)
      for (int o = (0); o <= (k - 1); o++) {
        if (j - 1 >= 1)
          f[i - 1][j - 1][(o + a[i - 1][j - 1]) % k] =
              max(f[i - 1][j - 1][(o + a[i - 1][j - 1]) % k],
                  f[i][j][o] + a[i - 1][j - 1]);
        if (j + 1 <= m)
          f[i - 1][j + 1][(o + a[i - 1][j + 1]) % k] =
              max(f[i - 1][j + 1][(o + a[i - 1][j + 1]) % k],
                  f[i][j][o] + a[i - 1][j + 1]);
      }
  int ans = -1e9, p;
  for (int i = (1); i <= (m); i++)
    if (f[1][i][0] > ans) {
      p = i;
      ans = f[1][i][0];
    }
  if (ans < 0) {
    cout << -1;
    return 0;
  }
  solve(1, p, 0);
  cout << ans << endl << stp << endl;
  for (int i = (n - 1); i >= (1); i--) putchar(Ans[i]);
}
