#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e3 + 4;
int a[MAX][MAX];
char ar[MAX][MAX];
int f[203][203][203];
string s[104][104][20];
string p = "";
int charTonum(char x) { return x - 48; }
int remainder(int a, int b, int c) { return ((a - b) % c + c) % c; }
int m, n, mod;
int main() {
  int du, best = -1, stt = 0, idx = 0;
  cin >> n >> m >> mod;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> ar[i][j];
      a[i][j] = charTonum(ar[i][j]);
    }
  }
  mod = mod + 1;
  if (m >= 2 && n >= 2) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        for (int u = 0; u <= mod - 1; u++) {
          f[i][j][u] = -1;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        for (int u = 0; u <= mod - 1; u++) {
          s[i][j][u] = "";
        }
      }
    }
    for (int i = 1; i <= m; i++) {
      f[1][i][a[1][i] % mod] = a[1][i];
    }
    for (int i = 2; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        for (int k = 0; k <= mod - 1; k++) {
          du = remainder(k, a[i][j], mod);
          if (j >= 2 && j <= m - 1) {
            if (f[i - 1][j + 1][du] != -1 || f[i - 1][j - 1][du] != -1) {
              f[i][j][k] = max(f[i - 1][j + 1][du] + a[i][j],
                               f[i - 1][j - 1][du] + a[i][j]);
              if (f[i - 1][j + 1][du] > f[i - 1][j - 1][du]) {
                s[i][j][k] = s[i - 1][j + 1][du] + "L";
              } else
                s[i][j][k] = s[i - 1][j - 1][du] + "R";
            }
          } else if (j < 2) {
            if (f[i - 1][j + 1][du] != -1)
              f[i][j][k] = f[i - 1][j + 1][du] + a[i][j];
            s[i][j][k] = s[i - 1][j + 1][du] + "L";
          } else if (j > m - 1) {
            if (f[i - 1][j - 1][du] != -1)
              f[i][j][k] = f[i - 1][j - 1][du] + a[i][j];
            s[i][j][k] = s[i - 1][j - 1][du] + "R";
          }
        }
      }
    }
    for (int i = 1; i <= m; i++) {
      if (best < f[n][i][0]) {
        best = f[n][i][0];
        stt = i;
      }
    }
    for (int i = s[n][stt][0].length() - 1; i >= 0; i--) {
      if (s[n][stt][0][i] == 'R')
        p = p + "L";
      else
        p = p + "R";
    }
    cout << best << endl;
    if (stt != 0) {
      cout << stt << endl;
      cout << p;
    }
  } else if (m == 1 || n == 1) {
    if (n == 2) {
      cout << "-1";
    } else if (m == 2) {
      if (a[1][1] % mod != 0 && a[1][2] % mod != 0) {
        cout << "-1";
      } else if (a[1][1] % mod == 0 && a[1][2] % mod != 0) {
        cout << a[1][1] << endl << "1";
      } else if (a[1][1] % mod != 0 && a[1][2] % mod == 0) {
        cout << a[1][2] << endl << "2";
      } else if (a[1][1] % mod == 0 && a[1][2] % mod == 0) {
        if (a[1][1] > a[1][2])
          cout << a[1][1] << endl << "1";
        else
          cout << a[1][2] << endl << "2";
      }
    } else {
      if (a[1][1] % mod == 0) {
        cout << a[1][1] << endl << "1";
      }
    }
  }
}
