#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, K;
  cin >> n >> m >> K;
  K++;
  int B[n][m];
  int dp[n][m][K];
  char F[n][m][K];
  int R[n][m][K];
  memset((R), (-1), sizeof(R));
  memset((dp), (-1), sizeof(dp));
  memset((F), ('?'), sizeof(F));
  for (int _n(n), i(0); i < _n; i++)
    for (int _n(m), j(0); j < _n; j++) {
      char cc;
      cin >> cc;
      B[n - 1 - i][j] = cc - '0';
    }
  for (int _n(m), j(0); j < _n; j++) dp[0][j][B[0][j] % K] = B[0][j];
  for (int _n(n - 1), i(0); i < _n; i++)
    for (int _n(m), j(0); j < _n; j++)
      for (int _n(K), k(0); k < _n; k++)
        if (dp[i][j][k] >= 0) {
          for (int dj = -1, it = 0; it < 2; dj = dj * dj, ++it) {
            const int jj = j + dj;
            if (jj < 0 || jj >= m) continue;
            const int rem = (dp[i][j][k] + B[i + 1][jj]) % K;
            if (dp[i + 1][jj][rem] < dp[i][j][k] + B[i + 1][jj]) {
              dp[i + 1][jj][rem] = dp[i][j][k] + B[i + 1][jj];
              F[i + 1][jj][rem] = dj < 0 ? 'L' : 'R';
              R[i + 1][jj][rem] = k;
            }
          }
        }
  int idx = -1;
  for (int _n(m), j(0); j < _n; j++)
    if (dp[n - 1][j][0] != -1) {
      if (idx == -1 || dp[n - 1][idx][0] < dp[n - 1][j][0]) idx = j;
    }
  if (idx == -1) {
    cout << -1 << endl;
  } else {
    cout << dp[n - 1][idx][0] << endl;
    string legend = "";
    for (int i = n - 1, r = 0; i >= 1; --i) {
      legend += F[i][idx][r];
      int t = idx;
      idx += F[i][idx][r] == 'L' ? 1 : -1;
      r = R[i][t][r];
    }
    reverse((legend).begin(), (legend).end());
    cout << idx + 1 << endl;
    cout << legend << endl;
  }
  return 0;
}
