#include <bits/stdc++.h>
using namespace std;
long long int inf = 1e18;
long long int p = 1e9 + 7;
long double eps = 1e-9;
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int pwr(long long int x, long long int y) {
  long long int res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, y, x, z, g, key, n, m, h, t, a, c, j, k, w, q;
  long long int t2, t3, t4, t1, t5, t6;
  string s;
  t = 1;
  while (t--) {
    cin >> n >> m >> k;
    long long int dp[n][m][k + 1];
    memset(dp, -1, sizeof(dp));
    long long int arr[n][m];
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        char temp;
        cin >> temp;
        arr[i][j] = temp - '0';
      }
    }
    for (i = 0; i < m; i++) {
      long long int val = arr[0][i] % (k + 1);
      dp[0][i][val] = arr[0][i];
    }
    for (i = 1; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (j - 1 >= 0) {
          t1 = arr[i][j];
          for (long long int l = 0; l <= k; l++) {
            if (dp[i - 1][j - 1][l] != -1) {
              t2 = (t1 + l) % (k + 1);
              dp[i][j][t2] = std::max(dp[i][j][t2], dp[i - 1][j - 1][l] + t1);
            }
          }
        }
        if (j + 1 < m) {
          t1 = arr[i][j];
          for (long long int l = 0; l <= k; l++) {
            if (dp[i - 1][j + 1][l] != -1) {
              t2 = (t1 + l) % (k + 1);
              dp[i][j][t2] = std::max(dp[i][j][t2], dp[i - 1][j + 1][l] + t1);
            }
          }
        }
      }
    }
    long long int ans = -1;
    long long int ind;
    for (j = 0; j < m; j++) {
      if (dp[n - 1][j][0] > ans) {
        ans = dp[n - 1][j][0];
        ind = j;
      }
    }
    if (ans == -1)
      cout << ans;
    else {
      cout << ans << '\n';
      cout << ind + 1 << "\n";
      long long int curi = n - 1, curj = ind, curk = 0;
      vector<char> out;
      while (curi != 0) {
        long long int nj = -1, nk;
        if (curj - 1 >= 0) {
          for (long long int l = 0; l <= k; l++) {
            t1 = arr[curi][curj];
            if (dp[curi - 1][curj - 1][l] != -1) {
              t2 = (t1 + l) % (k + 1);
              if (((dp[curi - 1][curj - 1][l] + t1) == dp[curi][curj][curk]) &&
                  (t2 == curk)) {
                nj = curj - 1;
                nk = l;
                break;
              }
            }
          }
        }
        if (nj == -1) {
          for (long long int l = 0; l <= k; l++) {
            t1 = arr[curi][curj];
            if (dp[curi - 1][curj + 1][l] != -1) {
              t2 = (t1 + l) % (k + 1);
              if (((dp[curi - 1][curj + 1][l] + t1) == dp[curi][curj][curk]) &&
                  (t2 == curk)) {
                nj = curj + 1;
                nk = l;
                break;
              }
            }
          }
        }
        if (nj == curj - 1)
          out.push_back('L');
        else
          out.push_back('R');
        curi--;
        curj = nj;
        curk = nk;
      }
      for (auto u : out) cout << u;
    }
  }
  return 0;
}
