#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
template <typename T>
void Out(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) Out(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e2 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;
int dp[N][N][15], mp[N][N];
pair<int, int> path[N][N][15];
int n, m, k;
void print(int x, int pery, int permod, int nowy, int nowmod) {
  if (x < n)
    print(x + 1, nowy, nowmod, path[x][nowy][nowmod].first,
          path[x][nowy][nowmod].second);
  if (x == n) cout << nowy << '\n';
  if (x > 1) {
    if (nowy > pery) {
      cout << 'L';
    } else
      cout << 'R';
  }
}
signed main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      char ch;
      cin >> ch;
      mp[i][j] = ch - '0';
    }
  k++;
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= m; i++)
    for (int j = 0; j <= 12; j++) dp[n + 1][i][j] = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= m; j++) {
      for (int l = 0; l <= k; l++) {
        if (j - 1 >= 1 && dp[i + 1][j - 1][l] != -1) {
          int mod = (dp[i + 1][j - 1][l] + mp[i][j]) % k;
          if (dp[i][j][mod] < dp[i + 1][j - 1][l] + mp[i][j]) {
            dp[i][j][mod] = dp[i + 1][j - 1][l] + mp[i][j];
            path[i][j][mod] = {j - 1, l};
          }
        }
        if (j + 1 <= m && dp[i + 1][j + 1][l] != -1) {
          int mod = (dp[i + 1][j + 1][l] + mp[i][j]) % k;
          if (dp[i][j][mod] < dp[i + 1][j + 1][l] + mp[i][j]) {
            dp[i][j][mod] = dp[i + 1][j + 1][l] + mp[i][j];
            path[i][j][mod] = {j + 1, l};
          }
        }
      }
    }
  }
  int ans = -1;
  int x = -1, y = -1, mod = -1;
  for (int i = 1; i <= m; i++) {
    if (ans < dp[1][i][0]) {
      ans = dp[1][i][0];
      x = 1, y = i, mod = 0;
    }
  }
  if (ans == -1)
    cout << -1 << '\n';
  else {
    cout << ans << '\n';
    print(x, 0, 0, y, mod);
  }
  return 0;
}
