#include <bits/stdc++.h>
using namespace std;
char str[107][107];
int pre[107][107][15], dp[107][107][15];
int n, m, k;
int a[107];
int main() {
  cin >> n >> m >> k;
  ++k;
  int x, y;
  for (int i = 0; i < n; ++i) scanf("%s", str[i]);
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < m; ++i) {
    x = str[n - 1][i] - '0';
    dp[n - 1][i][x % k] = x;
  }
  for (int i = n - 1; i > 0; --i) {
    for (int j = 0; j < m; ++j)
      for (int c = 0; c < k; ++c)
        if (dp[i][j][c] >= 0) {
          if (j) {
            x = str[i - 1][j - 1] - '0';
            if (dp[i - 1][j - 1][(x + c) % k] < dp[i][j][c] + x) {
              dp[i - 1][j - 1][(x + c) % k] = dp[i][j][c] + x;
              pre[i - 1][j - 1][(x + c) % k] = 'L';
            }
          }
          if (j < m - 1) {
            x = str[i - 1][j + 1] - '0';
            if (dp[i - 1][j + 1][(x + c) % k] < dp[i][j][c] + x) {
              dp[i - 1][j + 1][(x + c) % k] = dp[i][j][c] + x;
              pre[i - 1][j + 1][(x + c) % k] = 'R';
            }
          }
        }
  }
  int ans = -1;
  for (int i = 0; i < m; ++i)
    if (dp[0][i][0] >= ans) {
      ans = dp[0][i][0];
      y = i;
    }
  if (ans == -1) {
    puts("-1");
    return 0;
  }
  int c = 0;
  for (int i = 0; i < n - 1; ++i) {
    x = str[i][y] - '0';
    a[i] = pre[i][y][c];
    if (a[i] == 'L')
      ++y;
    else
      --y;
    c = (c - x + k) % k;
    if (c < 0) c += k;
  }
  printf("%d\n%d\n", ans, y + 1);
  for (int i = n - 2; i >= 0; --i) printf("%c", char(a[i]));
  puts("");
}
