#include <bits/stdc++.h>
using namespace std;
int n, m, mod, dp[105][105][15], a[105][105];
char c[105][105];
vector<int> trace[105][105][15];
int main() {
  cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
  cin >> n >> m >> mod;
  mod++;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      a[i][j] = c[i][j] - '0';
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= mod; k++) dp[i][j][k] = INT_MIN;
    }
  }
  for (int j = 1; j <= m; j++) {
    dp[n][j][a[n][j] % mod] = a[n][j];
    trace[n][j][a[n][j] % mod].push_back(j);
  }
  for (int i = n; i > 1; i--) {
    for (int j = 1; j <= m; j++) {
      for (int k = 0; k <= mod; k++) {
        if (dp[i][j][k] == INT_MIN) continue;
        if (j - 1 >= 1) {
          if (dp[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod] <
              dp[i][j][k] + a[i - 1][j - 1]) {
            trace[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod].clear();
            dp[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod] =
                max(dp[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod],
                    dp[i][j][k] + a[i - 1][j - 1]);
            for (int l = 0; l < trace[i][j][k].size(); l++)
              trace[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod].push_back(
                  trace[i][j][k][l]);
            trace[i - 1][j - 1][(k + a[i - 1][j - 1]) % mod].push_back(30);
          }
        }
        if (j + 1 <= m) {
          if (dp[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod] <
              dp[i][j][k] + a[i - 1][j + 1]) {
            trace[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod].clear();
            dp[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod] =
                max(dp[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod],
                    dp[i][j][k] + a[i - 1][j + 1]);
            for (int l = 0; l < trace[i][j][k].size(); l++)
              trace[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod].push_back(
                  trace[i][j][k][l]);
            trace[i - 1][j + 1][(k + a[i - 1][j + 1]) % mod].push_back(45);
          }
        }
      }
    }
  }
  int place, max1 = INT_MIN;
  for (int j = 1; j <= m; j++) {
    if (dp[1][j][0] > max1) {
      max1 = max(max1, dp[1][j][0]);
      place = j;
    }
  }
  if (max1 == INT_MIN) {
    cout << -1;
    return 0;
  }
  cout << max1 << "\n";
  for (int i = 0; i < trace[1][place][0].size(); i++) {
    if (i == 0)
      cout << trace[1][place][0][i] << "\n";
    else {
      if (trace[1][place][0][i] == 30)
        cout << "L";
      else
        cout << "R";
    }
  }
}
