#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define rep0(i,n) for ((i)=0;(i)<(n);(i)++)
using namespace std;
long long n,m,s,i;
vector<int> ans;
long long gcd(long long x,long long y){
	if(!y) return x;
	long long t=gcd(y,x%y);
	s+=x/y;return t;
}
void print(long long x,long long y){
	if(!x){
		while(y--)ans.push_back(2);
		return; 
	}
	if(!y){
		while(x--)ans.push_back(1);
		return; 
	}
	if(x>y){
		while(x>=y){
			ans.push_back(3);
			x-=y;
		}
	}
	else{
		while(x<=y){
			ans.push_back(4);
			y-=x;
		}
	}
	print(x,y);
}
int main(){
	srand(time(NULL));
	cin>>n;
	for(;;){
		m=(rand()+rand()*65536ll+rand()*65536ll*65536ll/*+rand()*65536ll*65536ll*65536ll*/)%n;
		s=0;
		long long g=gcd(n,m);
		if(s+g>130) continue;
		print(n,m);
		printf("%d\n",ans.size());reverse(ans.begin(),ans.end());
		rep0(i,ans.size())printf("%d\n",ans[i]);
		return 0;
	}
	return 0;
}
#include<bits/stdc++.h>
//#pragma GCC optimize "trapv"
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define fast_az_fuk      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll               long long
#define lll              __int128
#define ull              unsigned ll
#define ld               long double 
#define pb               push_back 
#define pf               push_front
#define dll              deque<ll> 
#define vll              vector<ll>
#define vvll             vector<vll> 
#define pll              pair<ll,ll> 
#define vpll             vector<pll>
#define dpll             deque<pll>
#define mapll            map<ll,ll>
#define umapll           umap<ll,ll>
#define endl             "\n" 
#define all(v)           v.begin(),v.end() 
#define ms(a,x)          memset(a,x,sizeof(a))
#define random(l,r,T)    uniform_int_distribution<T>(l,r)(rng)


//#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//using namespace __gnu_pbds;


template<typename T> istream& operator >>(istream &in,vector<T> &v){ for(auto &x:v) in>>x; return in;}
template<typename T> ostream& operator <<(ostream &out,vector<T> &v){ for(auto &x:v) out<<x<<' '; return out;}
template<typename T1,typename T2> istream& operator >>(istream &in,pair<T1,T2> &p){ in>>p.first>>p.second; return in;}
template<typename T1,typename T2> ostream& operator <<(ostream &out,pair<T1,T2> &p){ out<<p.first<<' '<<p.second; return out;}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
template<class T, class H>using umap=unordered_map<T,H,custom_hash>;
template<class T>using uset=unordered_set<T,custom_hash>;


int32_t main()
{
    clock_t clk = clock();
    fast_az_fuk
    string s; cin>>s; deque<char> ans; ans.pb(s[0]); bool back=1; if(s[0] == 'R') {ans.pop_back();} s.erase(s.begin()); 
    for(char c : s){
        if(c == 'R') back = 1 - back;
        else {
            if(back){
                ans.pb(c);
            }
            else{
                ans.pf(c);
            }
        }
    }
    if(!back) reverse(all(ans));
    string final; ll n = ans.size(); final += '?';
    for(ll i=0;i<n;i++){
        if(final.back() == ans[i]){
            final.pop_back();
        }
        else final += ans[i];
    }
    final.erase(final.begin());
    cout<<final;
    // cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';
    return 0;
}