#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e14;
long long n, m, k, dp[102][102][11], board[101][101];
vector<char> s;
long long solve(long long x, long long y, long long sum) {
  if (x == n + 1) {
    if (sum == 0) {
      return 0;
    }
    return -inf;
  }
  if (y < 1 || y > m) return -inf;
  long long &ans = dp[x][y][sum];
  if (ans != -1) return ans;
  ans = board[x][y] + max(solve(x + 1, y - 1, (sum + board[x][y]) % k),
                          solve(x + 1, y + 1, (sum + board[x][y]) % k));
  return ans;
}
void path(long long x, long long y, long long sum) {
  if (x == n) return;
  long long &ans = dp[x][y][sum];
  long long nxtsum = (sum + board[x][y]) % k;
  if (ans == (board[x][y] + solve(x + 1, y - 1, nxtsum))) {
    cout << "L";
    path(x + 1, y - 1, nxtsum);
  } else if (ans == (board[x][y] + solve(x + 1, y + 1, nxtsum))) {
    cout << "R";
    path(x + 1, y + 1, nxtsum);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  k++;
  string s1;
  for (long long i = n; i >= 1; i--) {
    cin >> s1;
    for (long long j = 1; j <= m; j++)
      board[i][j] = (long long)(s1[j - 1] - '0');
  }
  memset(dp, -1, sizeof(dp));
  long long sol = -1, idx = -1;
  for (int i = 1; i <= m; i++) {
    long long val = solve(1, i, 0);
    if (sol < val) {
      sol = val;
      idx = i;
    }
  }
  cout << sol << "\n";
  if (idx != -1) {
    cout << idx << "\n";
    path(1, idx, 0);
  }
  return 0;
}
