#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  int mod = k + 1;
  vector<vector<vector<int>>> dp(n,
                                 vector<vector<int>>(m, vector<int>(mod, -1)));
  vector<vector<int>> grid(n, vector<int>(m, 0));
  for (int x = 0; x < n; x++) {
    for (int y = 0; y < m; y++) {
      char next;
      cin >> next;
      grid[x][y] = next - '0';
    }
  }
  for (int x = n - 1; x >= 0; x--) {
    for (int y = 0; y < m; y++) {
      if (x == n - 1) {
        dp[x][y][grid[x][y] % mod] = grid[x][y];
      } else if (y == 0) {
        for (int z = 0; z < mod; z++) {
          if (dp[x + 1][1][z] != -1) {
            dp[x][0][(z + grid[x][y]) % mod] = grid[x][y] + dp[x + 1][1][z];
          }
        }
      } else if (y == m - 1) {
        for (int z = 0; z < mod; z++) {
          if (dp[x + 1][m - 2][z] != -1) {
            dp[x][m - 1][(z + grid[x][y]) % mod] =
                grid[x][y] + dp[x + 1][m - 2][z];
          }
        }
      } else {
        for (int z = 0; z < mod; z++) {
          int prev = max(dp[x + 1][y + 1][z], dp[x + 1][y - 1][z]);
          if (prev != -1) {
            dp[x][y][(z + grid[x][y]) % mod] = grid[x][y] + prev;
          }
        }
      }
    }
  }
  int ans = -1;
  int index = -1;
  for (int y = 0; y < m; y++) {
    if (dp[0][y][0] > ans) {
      ans = dp[0][y][0];
      index = y;
    }
  }
  if (index == -1) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
    int count = 1;
    vector<char> dir;
    while (count < n) {
      ans -= grid[count - 1][index];
      if (index == 0) {
        dir.push_back('L');
        index++;
      } else if (index == m - 1) {
        dir.push_back('R');
        index--;
      } else {
        if (dp[count][index - 1][ans % mod] == ans) {
          dir.push_back('R');
          index--;
        } else {
          dir.push_back('L');
          index++;
        }
      }
      count++;
    }
    cout << index + 1 << endl;
    while (!dir.empty()) {
      cout << dir.back();
      dir.pop_back();
    }
    cout << endl;
  }
}
