#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}
ll lcm(ll a, ll b){
	return a*b/gcd(a,b);
}
ll Solve(ll n){
	ll ans = 1;
	for (ll i=2;i<=n;++i){
		ans = lcm(i,ans);
	}return ans + (ll)1;
}
int main(){
	ll n;scanf("%lld",&n);
	printf("%lld\n",Solve(n));
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S, T;
  cin >> S;

  bool isReversed = false;

  for(int i=0; i<S.size(); i++) {
    if(S[i] == 'R') {
      isReversed = !isReversed;
    } else {
      if(!isReversed) {
        if(!T.empty() && T[T.size()-1] == S[i]) {
          T.erase(T.size()-1);
        } else {
          T += S[i];
        }
      } else {
        if(!T.empty() && T[0] == S[i]) {
          T.erase(0, 1);
        } else {
          T = S[i] + T;
        }
      }
    }
  }

  if(isReversed) reverse(T.begin(), T.end());
  cout << T << endl;
}
