#include <bits/stdc++.h>
using namespace std;
long long dp[105][105][15];
long long n, m, k;
long long rec[105][105];
stack<char> q;
void solve() {
  char c;
  long long i, j, l;
  cin >> n >> m >> k;
  k++;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> c;
      rec[i][j] = c - '0';
    }
    getchar();
  }
  memset(dp, -1, sizeof(dp));
  for (j = 1; j <= m; j++) {
    dp[n][j][rec[n][j] % k] = rec[n][j];
  }
  for (i = n - 1; i >= 1; i--) {
    for (j = 1; j <= m; j++) {
      long long pos;
      if (j - 1 >= 1) {
        pos = j - 1;
        for (l = 0; l < k; l++) {
          if (dp[i + 1][pos][l] == -1) continue;
          long long x = dp[i + 1][pos][l] + rec[i][j];
          dp[i][j][x % k] = max(dp[i][j][x % k], x);
        }
      }
      if (j + 1 <= m) {
        pos = j + 1;
        for (l = 0; l < k; l++) {
          if (dp[i + 1][pos][l] == -1) continue;
          long long x = dp[i + 1][pos][l] + rec[i][j];
          dp[i][j][x % k] = max(dp[i][j][x % k], x);
        }
      }
    }
  }
  long long ans = -1;
  long long pos = 1;
  for (j = 1; j <= m; j++) {
    if (dp[1][j][0] > ans) {
      pos = j;
      ans = dp[1][j][0];
    }
  }
  if (ans == -1) {
    cout << -1 << endl;
    return;
  }
  cout << ans << endl;
  for (i = 2; i <= n;) {
    long long x = rec[i - 1][pos];
    if (pos - 1 >= 1) {
      for (l = 0; l < k; l++) {
        if (dp[i][pos - 1][l] == ans - x) {
          ans -= x;
          q.push('R');
          pos--;
          goto A;
        }
      }
    }
    if (pos + 1 <= m) {
      for (l = 0; l < k; l++) {
        if (dp[i][pos + 1][l] == ans - x) {
          ans -= x;
          q.push('L');
          pos++;
          goto A;
        }
      }
    }
  A:
    i++;
  }
  cout << pos << endl;
  while (!q.empty()) {
    cout << q.top();
    q.pop();
  }
}
int main() { solve(); }
