#include <bits/stdc++.h>
using namespace std;
const int Maxn = 110;
string s[Maxn];
int f[Maxn][Maxn][12];
int pre[Maxn][Maxn][12];
int main() {
  string ans;
  int n, m, mod;
  int maxn = -1, idx = -1;
  ios::sync_with_stdio(0);
  memset(f, -1, sizeof(f));
  cin >> n >> m >> mod;
  mod = mod + 1;
  for (int i = 1; i <= n; i++) cin >> s[i];
  for (int i = 1; i <= m; i++) {
    int t = s[n][i - 1] - '0';
    f[n][i][t % mod] = t;
  }
  for (int i = n - 1; i >= 1; i--)
    for (int j = 1; j <= m; j++) {
      int t = s[i][j - 1] - '0';
      if (j > 1)
        for (int k = 0; k < mod; k++)
          if (f[i + 1][j - 1][k] != -1) {
            int tmp = f[i + 1][j - 1][k] + t;
            if (f[i][j][tmp % mod] < tmp) {
              f[i][j][tmp % mod] = tmp;
              pre[i][j][tmp % mod] = j - 1;
            }
          }
      if (j < m)
        for (int k = 0; k < mod; k++)
          if (f[i + 1][j + 1][k] != -1) {
            int tmp = f[i + 1][j + 1][k] + t;
            if (f[i][j][tmp % mod] < tmp) {
              f[i][j][tmp % mod] = tmp;
              pre[i][j][tmp % mod] = j + 1;
            }
          }
    }
  for (int j = 1; j <= m; j++)
    if (maxn < f[1][j][0]) {
      idx = j;
      maxn = f[1][j][0];
    }
  cout << maxn << endl;
  if (maxn != -1) {
    for (int i = 1; i < n; i++) {
      int tmp = pre[i][idx][maxn % mod];
      if (tmp > idx)
        ans = "L" + ans;
      else
        ans = "R" + ans;
      maxn -= s[i][idx - 1] - '0';
      idx = tmp;
    }
    cout << idx << endl;
    cout << ans << endl;
  }
  return 0;
}
