#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e2 + 10;
int n, m, kk, dp[MAXN][MAXN][20], mp[MAXN][MAXN];
int pre[MAXN][MAXN][20];
int main() {
  cin >> n >> m >> kk;
  kk++;
  memset(dp, -1, sizeof dp);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%1d", &mp[i][j]);
  for (int i = 1; i <= m; i++) dp[n][i][mp[n][i] % kk] = mp[n][i];
  for (int i = n - 1; i >= 1; i--)
    for (int j = 1; j <= m; j++)
      for (int k = 0; k < kk; k++) {
        if (j - 1 > 0 &&
            dp[i + 1][j - 1][(k - mp[i][j] % kk + kk) % kk] != -1 &&
            dp[i + 1][j - 1][(k - mp[i][j] % kk + kk) % kk] + mp[i][j] >
                dp[i][j][k]) {
          dp[i][j][k] =
              dp[i + 1][j - 1][(k - mp[i][j] % kk + kk) % kk] + mp[i][j];
          pre[i][j][k] = j - 1;
        }
        if (j + 1 <= m &&
            dp[i + 1][j + 1][(k - mp[i][j] % kk + kk) % kk] != -1 &&
            dp[i + 1][j + 1][(k - mp[i][j] % kk + kk) % kk] + mp[i][j] >
                dp[i][j][k]) {
          dp[i][j][k] =
              dp[i + 1][j + 1][(k - mp[i][j] % kk + kk) % kk] + mp[i][j];
          pre[i][j][k] = j + 1;
        }
      }
  int ans = -1, t;
  for (int i = 1; i <= m; i++)
    if (dp[1][i][0] > ans) {
      ans = dp[1][i][0];
      t = i;
    }
  printf("%d\n", ans);
  if (ans != -1) {
    int rt;
    stack<char> sta;
    int tmp = t;
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      int ttmp = tmp, ccnt = cnt;
      tmp = pre[i][ttmp][ccnt];
      cnt = ((ccnt - mp[i][ttmp]) % kk + kk) % kk;
      if (tmp == ttmp - 1)
        sta.push('R');
      else
        sta.push('L');
      if (i == n - 1) rt = tmp;
    }
    printf("%d\n", rt);
    while (!sta.empty()) {
      cout << sta.top();
      sta.pop();
    }
    cout << endl;
  }
  return 0;
}
