#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
long long MOD = 1000000009;
long long int n, m, k;
long long int mat[110][110];
long long int dp[110][110][15];
long long int f;
long long int go(long long int row, long long int col, long long int rem) {
  if (col < 0 || col >= m) return -1e15;
  if (row >= n) {
    if (rem == 0) return 0;
    return -1e15;
  }
  long long int ret = dp[row][col][rem];
  if (ret != -1) return ret;
  long long int ans = 0;
  {
    long long int p1 = go(row + 1, col + 1, (rem + mat[row][col]) % (k + 1));
    long long int p2 = go(row + 1, col - 1, (rem + mat[row][col]) % (k + 1));
    ans = mat[row][col] + max(p1, p2);
  }
  return dp[row][col][rem] = ans;
}
void path(long long int row, long long int col, long long int rem) {
  if (row == n - 1) return;
  long long int ans = dp[row][col][rem];
  long long int i = row;
  long long int j = col;
  if (col == 0) {
    if (ans ==
        (mat[row][col] + go(i + 1, j + 1, (mat[row][col] + rem) % (k + 1)))) {
      cout << "R";
      path(i + 1, j + 1, (mat[row][col] + rem) % (k + 1));
    }
  } else if (col == m - 1) {
    if (ans ==
        (mat[row][col] + go(i + 1, j - 1, (mat[row][col] + rem) % (k + 1)))) {
      cout << "L";
      path(i + 1, j - 1, (mat[row][col] + rem) % (k + 1));
    }
  } else {
    if (ans ==
        (mat[row][col] + go(i + 1, j - 1, (mat[row][col] + rem) % (k + 1)))) {
      cout << "L";
      path(i + 1, j - 1, (mat[row][col] + rem) % (k + 1));
    } else {
      cout << "R";
      path(i + 1, j + 1, (mat[row][col] + rem) % (k + 1));
    }
  }
}
void solve() {
  cin >> n >> m >> k;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      char ch;
      cin >> ch;
      mat[n - 1 - i][j] = ch - '0';
    }
  }
  long long int ans = -1, ind = 0;
  memset(dp, -1, sizeof(dp));
  f = 0;
  for (long long int i = 0; i < m; i++) {
    long long int p = go(0, i, 0);
    if (p >= ans) ind = i;
    ans = max(p, ans);
  }
  if (ans < 0)
    cout << -1 << '\n';
  else {
    f = 1;
    cout << ans << '\n';
    cout << ind + 1 << '\n';
    path(0, ind, 0);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
