#include<bits/stdc++.h>
#define ll __int128
using namespace std;

const int N = 55;

int n;
int primes[N] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}, book[N];
ll ans = 1e30;

ll gcd(ll a, ll b){ return b ? gcd(b, a % b) : a;}

void print(__int128 x)  {  
    if(!x)  
    {  
        puts("0");  
        return ;  
    }  
    string ret="";  
    while(x)  
    {  
        ret+=x%10+'0';  
        x/=10;  
    }  
    reverse(ret.begin(),ret.end());  
    cout<<ret<<endl;  
} 

bool check(ll x){
	for(int i = 1; i <= n; ++ i)
		if(gcd(x, book[i]) == 1)	return false;
	return true;	
}

int main(){
	cin >> n;
	for(int i = 1; i <= n; ++ i)	cin >> book[i];
	for(int i = 1; i < (1 << 15); ++ i){
		ll tmp = 1;
		for(int j = 0; j < 15; ++ j){
			if((i >> j) & 1)	tmp *= primes[j];
		}
		//printf("ans = %d\n", ans);
		if(check(tmp)){
			ans = min(ans, tmp);
		}
	}
	print(ans);
	return 0;
}
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

string S;
char mem[1000020];
const int base = 500010;

signed main()
{
    cin >> S;
    // int l = base, r = base + 1;
    // bool flip = false;
    // for(auto e : S)
    // {
    //     if(e == 'R')flip = !flip;
    //     else
    //     {
    //         if(flip)mem[l--] = e;
    //         else mem[r++] = e;
    //     }
    // }

    // string s;
    // if(flip)for(int i = r - 1; i > l; i--)s.push_back(mem[i]);
    // else for(int i = l + 1; i < r; i++)s.push_back(mem[i]);

    // cout << s << endl;

    deque<char> s;
    bool flip = false;
    for(auto e : S)
    {
        if(e == 'R')flip = !flip;
        else
        {
            if(flip)s.push_front(e);
            else s.push_back(e);
        }
    }
    if(flip)reverse(s.begin(), s.end());

    string ans;
    for(int i = 0; i < s.size(); i++)
    {
        if(ans.size() == 0 || ans.back() != s[i])ans.push_back(s[i]);
        else ans.pop_back();
    }
    cout << ans << endl;

    return 0;
}