#include <bits/stdc++.h>
using namespace std;
template <class T>
void show(T a, int n) {
  for (int i = 0; i < n; ++i) cout << a[i] << ' ';
  cout << endl;
}
template <class T>
void show(T a, int r, int l) {
  for (int i = 0; i < r; ++i) show(a[i], l);
  cout << endl;
}
const int N = 128;
const int M = 5000;
const int oo = 10000 * 10000 * 10;
int n, m, p;
char g[N][N];
int dp[N][N][15];
int f[N][N][15];
inline int mod(int v) { return v % (p + 1); }
string str;
int ans_d;
void print(int i, int j, int k) {
  if (i == n) {
    ans_d = j;
    return;
  }
  if (f[i][j][k] == 1) {
    print(i + 1, j + 1, mod(dp[i][j][k] - g[i][j]));
  } else {
    print(i + 1, j - 1, mod(dp[i][j][k] - g[i][j]));
  }
  if (f[i][j][k] == 1)
    str += "L";
  else
    str += "R";
}
void solve() {
  int i, j, k;
  for (i = 1; i <= n; ++i)
    for (j = 1; j <= m; ++j) {
      for (k = 0; k < p + 1; ++k) dp[i][j][k] = -oo;
    }
  for (j = 1; j <= m; ++j) {
    dp[n][j][mod(g[n][j])] = g[n][j];
  }
  for (i = n; i > 1; --i) {
    for (j = 1; j <= m; ++j) {
      for (k = 0; k < p + 1; ++k) {
        if (dp[i][j][k] == -oo) continue;
        int tj = j - 1;
        int tk;
        if (tj >= 1) {
          if (dp[i - 1][tj][mod(k + g[i - 1][tj])] <
              dp[i][j][k] + g[i - 1][tj]) {
            dp[i - 1][tj][mod(k + g[i - 1][tj])] = dp[i][j][k] + g[i - 1][tj];
            f[i - 1][tj][mod(k + g[i - 1][tj])] = 1;
          }
        }
        tj = j + 1;
        if (tj <= m) {
          tk = mod(k + g[i - 1][tj]);
          if (dp[i - 1][tj][tk] < dp[i][j][k] + g[i - 1][tj]) {
            dp[i - 1][tj][tk] = dp[i][j][k] + g[i - 1][tj];
            f[i - 1][tj][tk] = -1;
          }
        }
      }
    }
  }
  int ans = -oo;
  int d;
  for (j = 1; j <= m; ++j) {
    if (dp[1][j][0] > ans) {
      ans = dp[1][j][0];
      d = j;
    }
  }
  if (ans < 0) {
    puts("-1");
    return;
  }
  print(1, d, 0);
  printf("%d\n%d\n", ans, ans_d);
  cout << str << endl;
}
int main() {
  int i, j, cas = 0;
  scanf("%d %d %d", &n, &m, &p);
  for (i = 1; i <= n; ++i) {
    scanf("%s", g[i] + 1);
  }
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= m; ++j) {
      g[i][j] -= '0';
    }
  }
  solve();
  return 0;
}
