#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std ;
#define vi vector<int>
#define vvi vector< vi >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vc >
vvc paths ;
string path ;
vvi board ;
int go( int row , int col , int k ) ;
void find_path(int row , int col ) ;
int dp[ 110 ][ 110 ][ 15 ];
int K ;
int N , M ;
int main() {
int n , m , k ;
cin >> n >> m >> k ;
N = n ;
M = m ;
board = vvi ( n , vi ( m , 0 ) ) ;
string tmp ;
for ( int i = 0 ; i < n ; i ++ ) {
cin >> tmp ;
for ( int j = 0 ; j < tmp.size() ; j ++ ) {
board[ i ][ j ] = tmp[ j ] - '0' ;
}
}
int mx = -1 ;
K = k + 1 ;
int get_col = 0 ;
for ( int i = 0 ; i < m ; i ++ ) {
memset( dp , -1 , sizeof( dp ) ) ;
paths = vvc ( n , vc ( m ) ) ;
int val = go( n - 1 , i , 0 ) ;
if ( val > mx ) {
path.clear() ;
mx = val ;
get_col = i + 1 ;
find_path( n - 1 , i ) ;
}
}
if ( mx == -1 ) cout<<-1<<endl;
else {
cout<<mx<<endl ;
cout<<get_col<<endl ;
cout<< path << endl ;
}
return 0 ;
}
void find_path(int row , int col ) {
if ( row == 0 ) return ;
if( paths[ row ][ col ] == 'L' ) {
path += 'L';
find_path( row - 1 , col - 1 ) ;
}
else {
path += 'R';
find_path( row - 1 , col + 1 ) ;
}
}
int go( int row , int col , int k ) {
if ( row < 0 || row >= N || col < 0 || col >= M ) return -2 ;
if ( dp[ row ][ col ][ k ] != -1 ) return dp[ row ] [ col ] [ k ] ;
if ( row == 0 ) {
if ( ( ( k + board[ row ][ col ] ) % K ) == 0 ) {
dp[ row ][ col ][ k ] = board[ row ][ col ] ;
return dp[ row ][ col ][ k ] ;
}
dp[ row ][ col ][ k ] = -2 ;
return dp[ row ][ col ][ k ] ;
}
//int v = board[ row-1 ][ col ] ;
int L = go ( row - 1 , col - 1 , ( ( k + board[ row ][ col ] ) % K ) ) ;
int R = go ( row - 1 , col + 1 , ( ( k + board[ row ][ col ] ) % K ) ) ;
if ( L > R ) {
paths[ row ][ col ] = 'L';
}
else paths[ row ][ col ] = 'R' ;
if ( ( int ) max( L , R ) != -2 ) {
dp[ row ][ col ][ k ] = max( L , R ) + board[ row ][ col ];
}
else dp[ row ] [ col ] [ k ] = -2 ;
return dp[ row ][ col ][ k ] ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3N0cmluZz4KCnVzaW5nIG5hbWVzcGFjZSBzdGQgOyAKCiNkZWZpbmUgdmkgdmVjdG9yPGludD4KI2RlZmluZSB2dmkgdmVjdG9yPCB2aSA+IAojZGVmaW5lIHZzIHZlY3RvcjxzdHJpbmc+CiNkZWZpbmUgdmMgdmVjdG9yPGNoYXI+CiNkZWZpbmUgdnZjIHZlY3RvcjwgdmMgPiAgCgp2dmMgcGF0aHMgOyAKc3RyaW5nIHBhdGggOyAKdnZpIGJvYXJkIDsgCmludCBnbyggaW50IHJvdyAsIGludCBjb2wgLCBpbnQgayApIDsgCnZvaWQgZmluZF9wYXRoKGludCByb3cgLCBpbnQgY29sICkgOyAKaW50IGRwWyAxMTAgXVsgMTEwIF1bIDE1IF07CgppbnQgSyA7IAppbnQgTiAsIE0gOyAKaW50IG1haW4oKSB7CgoJaW50IG4gLCBtICwgayA7IAoKCWNpbiA+PiBuID4+IG0gPj4gayA7IAoKCU4gPSBuIDsgCglNID0gbSA7IAoJCglib2FyZCA9IHZ2aSAoIG4gLCB2aSAoIG0gLCAwICkgKSA7CgkgCgkKCXN0cmluZyB0bXAgIDsKCglmb3IgKCBpbnQgaSA9IDAgOyBpIDwgbiA7IGkgKysgKSB7CgoJCWNpbiA+PiB0bXAgOwoKCQlmb3IgKCBpbnQgaiA9IDAgOyBqIDwgdG1wLnNpemUoKSA7IGogKysgKSB7CgkJCWJvY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