#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
struct node {
  int a;
  string s[15];
  int k[15];
  int start[15];
};
int n, m, k1;
node arr[200][200];
int main() {
  cin >> n >> m >> k1;
  k1++;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    for (int j = 0; j < m; j++) {
      int x = temp[j] - '0';
      arr[i][j].a = x;
      arr[i][j].k[0] = -1;
      for (int z = 0; z <= k1; z++) {
        arr[i][j].s[z] = "";
        arr[i][j].k[z] = -1;
      }
      for (int z = 0; z < k1; z++) {
        if (x % k1 == z) {
          arr[i][j].k[z] = x;
          arr[i][j].start[z] = j + 1;
        }
      }
    }
  }
  for (int i = n - 2; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      int a = arr[i][j].a;
      for (int z = 0; z <= k1; z++) {
        arr[i][j].k[z] = -1;
        arr[i][j].s[z] = "";
        arr[i][j].start[z] = 0;
      }
      if (j - 1 >= 0) {
        for (int z = 0; z < k1; z++) {
          if (arr[i + 1][j - 1].k[z] != -1) {
            int b = arr[i + 1][j - 1].k[z] + a;
            for (int q = 0; q < k1; q++) {
              if (b % k1 == q and arr[i][j].k[q] < b) {
                arr[i][j].k[q] = b;
                arr[i][j].s[q] = arr[i + 1][j - 1].s[z] + 'R';
                arr[i][j].start[q] = arr[i + 1][j - 1].start[z];
              }
            }
          }
        }
      }
      if (j + 1 < m) {
        for (int z = 0; z < k1; z++) {
          if (arr[i + 1][j + 1].k[z] != -1) {
            int b = arr[i + 1][j + 1].k[z] + a;
            for (int q = 0; q < k1; q++) {
              if (b % k1 == q and arr[i][j].k[q] < b) {
                arr[i][j].k[q] = b;
                arr[i][j].s[q] = arr[i + 1][j + 1].s[z] + 'L';
                arr[i][j].start[q] = arr[i + 1][j + 1].start[z];
              }
            }
          }
        }
      }
    }
  }
  int ans = -1, stt;
  string ans_s;
  for (int i = 0; i < m; i++) {
    if (arr[0][i].k[0] > ans) {
      ans = arr[0][i].k[0];
      ans_s = arr[0][i].s[0];
      stt = arr[0][i].start[0];
    }
  }
  if (ans != -1) {
    cout << ans << "\n";
    cout << stt << "\n";
    cout << ans_s << "\n";
  } else {
    cout << -1 << "\n";
  }
  return 0;
}
