#include <bits/stdc++.h>
using namespace std;
#define int long long int
mt19937 rng(std::chrono::duration_cast<std::chrono::nanoseconds>(chrono::high_resolution_clock::now().time_since_epoch()).count());
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int N=200005;
#define M 1000000007
#define double long double
#define BINF 100000000000000
#define init(arr,val) memset(arr,val,sizeof(arr))
#define MAXN 17500001
#define deb(x) cout << #x << " " << x << "\n";
const int LG = 22;

int n, k;
int a[N], power[105];
string s;
int dp[101][101][101];

int get(int x, int y){
    if(x == y) return x;
    int s = x + y;
    if(s == 1) return 1;
    if(s == 2) return 0;
    return 2;
}

int get(int l, int r, int lvl){
   // cout << l << ' ' << r << ' ' << lvl << endl;
    if(lvl == 1){
        return get(a[l], a[r]);
    }
    if(dp[l][r][lvl] != -1) return dp[l][r][lvl];

    int g = power[lvl - 1];

    int x = get(l, (l + g - 1 + n) % n, lvl - 1);
    int y = get((l + g) % n , r, lvl - 1);

    return dp[l][r][lvl] = get(x, y);
}


#undef int 
int main() {
#define int long long int
ios_base::sync_with_stdio(false); 
cin.tie(0); 
cout.tie(0);

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("optput.txt", "w", stdout); 
#endif

    cin >> n >> k;
    cin >> s;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') a[i] = 0;
        else if(s[i] == 'P') a[i] = 1;
        else a[i] = 2;
    }

    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n; j++){
            for(int l = 0; l <= k; l++){
                dp[i][j][l] = -1;
            }
        }
    }

    power[0] = 1;
    for(int i = 1; i < 105; i++){
        power[i] = (2 * power[i - 1]) % n;
    }

    int ans = get(0, (power[k] - 1 + n) % n, k);

    if(ans == 0) cout << "R\n";
    else if(ans == 1) cout << "P\n";
    else cout << "S\n";


    

return 0;  
} 








#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){ 
    long long n,m,k;
    cin>>n>>m>>k;
    vector<long long> data(2000010,0),datac(2000010,0);
    if(n>m+k){
        cout<<0<<endl;
        return 0;
    }
    set<ll> sosuu;
    for(ll i=2;i<2000010;i++){
        sosuu.insert(i);
    }
    for(ll i=2;i<1500;i++){
        if(!sosuu.count(i)){
            continue;
        }
        for(ll j=2;j*i<2000010;j++){
            if(sosuu.count(i*j)){
                sosuu.erase(i*j);
            }
        }
    }
    
    for(ll x:sosuu){
        ll y=x;
        while(y<=n+m){
            data.at(x)+=(n+m)/y;
            data.at(x)-=n/y;
            data.at(x)-=m/y;
            y*=x;
        }
    }
    for(ll x:sosuu){
        ll y=x;
        while(y<=n+m){
            datac.at(x)+=(n+m)/y;
            datac.at(x)-=(n-k-1)/y;
            datac.at(x)-=(m+k+1)/y;
            y*=x;
        }
    }
    long long count=1,ccon=1;
    for(ll i=2;i<=n+m;i++){
        for(ll j=0;j<data.at(i);j++){
            count*=i;
            count%=1000000007;
            
        }
        //cout<<data.at(i)<<endl;
    }
    //cout<<endl;
    for(ll i=2;i<=n+m;i++){
        for(ll j=0;j<datac.at(i);j++){
            ccon*=i;
            ccon%=1000000007;
            //cout<<i<<endl;
            
        }
    }
    if(k==n){
        ccon=0;
    }
    //cout<<count<<" "<<ccon<<endl;
    cout<<(count-ccon+1000000007)%1000000007<<endl;
}
