#include <bits/stdc++.h>
using namespace std;
int n, m, k, mod;
int dp[100 + 10][100 + 10][15], src[100 + 10][100 + 10];
pair<pair<int, int>, pair<int, char> > par[100 + 10][100 + 10][15];
void read() {
  cin >> n >> m >> k;
  char s[100 + 10];
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j) {
      src[i][j + 1] = s[j] - '0';
    }
  }
  mod = k + 1;
}
int main() {
  read();
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      for (int t = 0; t < mod; ++t) {
        dp[i][j][t] = -1;
      }
    }
  }
  for (int i = 1; i <= m; ++i) {
    dp[n][i][src[n][i] % mod] = +src[n][i];
  }
  for (int i = n; i > 1; --i) {
    for (int j = 1; j <= m; ++j) {
      for (int t = 0; t < mod; ++t) {
        if (dp[i][j][t] == -1) continue;
        int amt = src[i - 1][j - 1] + dp[i][j][t];
        int pos = amt % mod;
        if (dp[i - 1][j - 1][pos] == -1) dp[i - 1][j - 1][pos] = amt;
        if (amt >= dp[i - 1][j - 1][pos])
          dp[i - 1][j - 1][pos] = amt, par[i - 1][j - 1][pos] = make_pair(
                                           make_pair(i, j), make_pair(t, 'L'));
        amt = src[i - 1][j + 1] + dp[i][j][t];
        pos = amt % mod;
        if (dp[i - 1][j + 1][pos] == -1) dp[i - 1][j + 1][pos] = amt;
        if (amt >= dp[i - 1][j + 1][pos])
          dp[i - 1][j + 1][pos] = amt, par[i - 1][j + 1][pos] = make_pair(
                                           make_pair(i, j), make_pair(t, 'R'));
      }
    }
  }
  int p = -1;
  for (int i = 1; i <= m; ++i) {
    if (dp[1][i][0] != -1) {
      if (p == -1 || dp[1][i][0] > dp[1][p][0]) p = i;
    }
  }
  if (p == -1) {
    cout << -1;
    return 0;
  }
  cout << dp[1][p][0] << endl;
  vector<char> ans;
  int t = 0;
  for (int i = 1; i < n; ++i) {
    ans.push_back(par[i][p][t].second.second);
    int a, b;
    a = p, b = t;
    p = par[i][a][b].first.second;
    t = par[i][a][b].second.first;
  }
  cout << p << endl;
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); ++i) cout << ans[i];
  return 0;
}
