#include <bits/stdc++.h>
using namespace std;
int a[102][102];
int dp[102][102][11];
pair<int, int> trace[102][102][11];
int n, m, k;
void truy_vet(int i, int j, int mod) {
  if (i == n) {
    cout << j << '\n';
    return;
  }
  pair<int, int> khue;
  if (trace[i][j][mod].first == j - 1) {
    khue = trace[i][j][mod];
    truy_vet(i + 1, khue.first, khue.second);
    cout << 'R';
    return;
  } else {
    khue = trace[i][j][mod];
    truy_vet(i + 1, khue.first, khue.second);
    cout << 'L';
    return;
  }
}
signed main() {
  cin >> n >> m >> k;
  k++;
  string s;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) a[i][j + 1] = s[j] - '0';
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m + 1; j++) {
      for (int p = 0; p < k; p++) dp[i][j][p] = -1;
    }
  }
  for (int i = 1; i <= m; i++) {
    dp[n][i][a[n][i] % k] = a[n][i];
  }
  for (int i = n - 1; i > 0; i--) {
    for (int j = 1; j <= m; j++) {
      for (int p = 0; p < k; p++) {
        if (dp[i + 1][j - 1][p] >= 0) {
          int tmp = a[i][j] + dp[i + 1][j - 1][p];
          dp[i][j][tmp % k] = max(tmp, dp[i][j][tmp % k]);
          trace[i][j][tmp % k] = make_pair(j - 1, p);
        }
        if (dp[i + 1][j + 1][p] >= 0) {
          int tmp = a[i][j] + dp[i + 1][j + 1][p];
          dp[i][j][tmp % k] = max(tmp, dp[i][j][tmp % k]);
          if (dp[i][j][tmp % k] == tmp)
            trace[i][j][tmp % k] = make_pair(j + 1, p);
        }
      }
    }
  }
  int mx = -1, pos = 0;
  for (int i = 1; i <= m; i++) {
    if (dp[1][i][0] >= 0) {
      mx = max(mx, dp[1][i][0]);
      if (mx == dp[1][i][0]) pos = i;
    }
  }
  if (mx != -1) {
    cout << mx << '\n';
    truy_vet(1, pos, 0);
  } else
    cout << -1;
}
