#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 1e2 + 7;
char dp[MAX_N][MAX_N];
char s[MAX_N];
int n, k;

int f_pow(int base, int b, int mod) {
	int res = 1;
	while (b) {
		if (b & 1) res = res * base % mod;
		base = base * base % mod;
		b >>= 1;
	}
	return res;
}

char ans(char a, char b) {
	if (a == 'P') {
		if (b == 'R') return 'P';
		if (b == 'S') return 'S';
		return 'P';
	} else if (a == 'R') {
		if (b == 'S') return 'R';
		if (b == 'P') return 'P';
		return 'R';
	} else {
		if (b == 'P') return 'S';
		if (b == 'R') return 'R';
		return 'S';
	}
}

int main() {
	scanf("%d%d", &n, &k);
	scanf("%s", s);
	for (int i = 0; i < n; ++i) dp[i][0] = s[i];
	for (int j = 1; j <= k; ++j) {
		for (int i = 0; i < n; ++i) {
			char a = dp[i][j - 1], b = dp[(i + f_pow(2, j - 1, n)) % n][j - 1];
			dp[i][j] = ans(a, b);
		}
	}
	printf("%c\n", dp[0][k]);
	return 0;
}
#include <bits/stdc++.h>
#define endl '\n'
#define sz(X) X.size()
#define IO cin.tie(0), ios_base::sync_with_stdio(0);
#define FOR(N) for(int i=0;i<N;++i)
#define FORf(X,V,N) for(int X=V;X<N;++X)
#define FORi(X,V,N,S) for(int X=V;(S>0?X<N:X>=N);X+=S)
#define EACH(X, V) for(auto& X : V)
#define For(X, V, N) for(int X = V, Len = N, X < V; ++X)
#define All(X) X.begin(), X.end()
#define ar array
using ll = long long;
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T, class C>
using Pset = tree<T, null_type, C, rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class P> inline bool umax(T& x, P y) {
	bool big; x = (big = x>y) ? x : y; return !big;
}
template<class T, class P> inline bool umin(T& x, P y) {
	bool big; x = (big = x<y) ? x : y; return !big;
}
template<class T> istream& operator>>(istream& is, vector<T>& vt) {
	for(auto& i : vt)
		is >> i;
	return is;
}
template<class T, unsigned int N> istream& operator>>(istream& is, array<T, N>& ary) {
	for(auto& i : ary)
		is >> i;
	return is;
}
template<class T1, class T2> istream& operator>>(istream& is, pair<T1, T2>& pr) {
	is >> pr.first >> pr.second;
	return is;
}
template<class T> void read(T& x) {
	cin >> x;
	cin.get();
}
template<class T, class ... P> void read(T& x, P& ... t) {
	cin >> x;
	read(t...);
}
template<class T> void readl(T& x) { // readline
	getline(cin, x);
}
template<class T, class ... P> void readl(T& x, P& ... t) {
	getline(cin, x);
	readl(t...);
}

template<class T> void write(T x) {
	cout << x;
}
template<class T, class ... P> void write(T x, P ... t) {
	cout << x;
	write(t...);
}
void print() { cout << '\n'; }
template<class T> void print(T x) {
	cout << x << '\n';
}
template<class T, class ... P> void print(T x, P ... t) {
	cout << x << ' ';
	print(t...);
}

#define fastIO


void solve() {
	string n;
	int k;
	read(n, k);
	while(k--) {
		if(sz(n) < 3)
			n += "200";
		else if(n.substr(sz(n)-2, 2) == "00" && ((n[sz(n)-3]-'0')&1) == 0) {
			int f = 0;
			FOR(2)
				n.pop_back();
			EACH(s, n) {
				int i = s-'0'+f*10;
				s = i/2+'0';
				f = i&1;
			}
		} else {
			n += "200";
		}
	}
	int id = 0;
	while(n[id] == '0')
		++id;
	print(n.substr(id, sz(n)-id));
}

int main() {
#ifdef fastIO
	IO;
#endif
	//int t;
	//cin >> t;
	//while(t--)
		solve();
}
