#include <bits/stdc++.h>
const int N = 101, M = 15;
char mp[N][N], res[N];
int f[N][N][M], step[N][N][M], a[N][N];
int main() {
  int n, m, mod, id, ans = -1, sum = 0;
  scanf("%d%d%d\n", &n, &m, &mod);
  for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) a[i][j] = mp[i][j] - '0';
  mod++;
  memset(f, -1, sizeof f);
  for (int i = 1; i <= m; i++) f[n][i][a[n][i] % mod] = a[n][i];
  for (int i = n - 1; i; i--)
    for (int j = 1; j <= m; j++)
      for (int k = 0; k < mod; k++) {
        int rem = ((k - a[i][j]) % mod + mod) % mod;
        if (j > 1 && f[i + 1][j - 1][rem] > f[i][j][k]) {
          f[i][j][k] = f[i + 1][j - 1][rem];
          step[i][j][k] = j - 1;
        }
        if (j < m && f[i + 1][j + 1][rem] > f[i][j][k]) {
          f[i][j][k] = f[i + 1][j + 1][rem];
          step[i][j][k] = j + 1;
        }
        if (f[i][j][k] >= 0) f[i][j][k] += a[i][j];
      }
  for (int i = 1; i <= m; i++)
    if (f[1][i][0] > ans) {
      ans = f[1][i][0];
      id = i;
    }
  printf("%d\n", ans);
  if (ans >= 0) {
    for (int i = 1; i < n; i++) {
      int next = step[i][id][sum];
      if (next == id + 1)
        res[n - i] = 'L';
      else
        res[n - i] = 'R';
      sum = ((sum - a[i][id]) % mod + mod) % mod;
      id = next;
    }
    printf("%d\n%s\n", id, res + 1);
  }
  return 0;
}
