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

#define N  200005
#define INF 1e17
#define MP make_pair 
const int mod = 998244353; 
typedef long long LL;

unordered_map<int, int> F;

int f(int n, int k)
{
	if (n < k) return 0;
	if (n == k) return 1;
	if (k == 0) return 0;
	if (F.count(n*3005+k)) return F[n*3005+k];
	LL ans = f(n, 2*k) + f(n-1, k-1);
	ans %= mod;
	F[n*3005+k] = ans;
	return ans;
}

int main()
{
	int n, k;
 	cin >> n >> k;
    cout <<f(n,k) << endl;	
	return 0;
} 
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <string.h>
#include <algorithm>
#include <cmath>
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) < (b) ? (a) : (b))
#define pb push_back
#define cl clear
#define MAXN 100005

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF = 1e9;

inline int read(){
	int x = 0, f = 1;
	char ch = getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')
			f = -1;
		ch = getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch = getchar();
	}
	return x*f;
}

int n, k, cnt;
char s[105][105];

void solve(){
	n = read();
	k = read();
	cin>>(s[0]+1);
	if(n==1){
		printf("%c\n",s[0][1]);
		return ;
	}
	for(cnt = 1 ; cnt <= k ; ++cnt){
		for(int i = 1, idx = 0 ; i <= n ; ++i, idx += 2){
			// printf("%d\n",i);
			if(s[cnt-1][idx%n+1]==s[cnt-1][(idx+1)%n+1]) s[cnt][i] = s[cnt-1][idx%n+1];
			if(s[cnt-1][idx%n+1]=='S'&&s[cnt-1][(idx+1)%n+1]=='R') s[cnt][i] = 'R';
			if(s[cnt-1][idx%n+1]=='R'&&s[cnt-1][(idx+1)%n+1]=='S') s[cnt][i] = 'R';
			if(s[cnt-1][idx%n+1]=='S'&&s[cnt-1][(idx+1)%n+1]=='P') s[cnt][i] = 'S';
			if(s[cnt-1][idx%n+1]=='P'&&s[cnt-1][(idx+1)%n+1]=='S') s[cnt][i] = 'S';
			if(s[cnt-1][idx%n+1]=='R'&&s[cnt-1][(idx+1)%n+1]=='P') s[cnt][i] = 'P';
			if(s[cnt-1][idx%n+1]=='P'&&s[cnt-1][(idx+1)%n+1]=='R') s[cnt][i] = 'P';
		}
	}
	printf("%c\n",s[k][1]);
}

int main(){
    int t = 1;
    // t = read();
    while(t--) solve();
    return 0;
}
