#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(998244353);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define rnfor(i,a,b) for(ll (i) = (b) - 1; (i) >= (a); --(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int dx[8]={1,0,-1,0,1,1,-1,-1};
const int dy[8]={0,1,0,-1,1,-1,1,-1};

int multipf(vector<string>& s){
    cout << s[0];
    rep1(i, s.size() - 1)cout << " " << s[i];
    cout << endl;
    return 0;
}

int multipf(vector<ll>& n){
    cout << n[0];
    rep1(i, n.size() - 1)cout << " " << n[i];
    cout << endl;
    return 0;
}

ll gcd(ll a,ll b){
    if(a < b)swap(a, b);
    if(b == 0) return a;
    return gcd(b,a%b);
}
 
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        ans %= mod;
        a = a * a;
        a %= mod;
        b >>= 1;
    }
    return ans % mod;
}

string solve(string s){
    string t = "";
    rep0(i, s.size()){
        if(s[i] == s[i + 1]){
            t.push_back(s[i]);
        }else if(s[i] + s[i + 1] == 163){
            t.push_back('S');
        }else if(s[i] + s[i + 1] == 165){
            t.push_back('R');
        }else t.push_back('P');
        ++i;
    }
    s = t;
    return s;
}

//modの値の確認をすること
int main(){
    ll n,k;
    string s;
    cin >> n >> k >> s;
    rep0(i, k)s = solve(s + s);
    pf(s[0]);
    return 0;
}

#include <map>
#include <queue>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define int long long
#define mp make_pair
const int mod = 998244353;
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 * 10 + ch - '0';
		ch = getchar ();
	}
	return x * f;
}
void write (int x) {
	if (x < 0) x = -x, putchar ('-');
	if (x >= 10) write (x / 10);
	putchar (x % 10 + '0');
}
int quickmod (int x, int y) {
	int Ans = 1;
	while (y) {
		if (y & 1) Ans = (Ans * x) % mod;
		x = (x * x) % mod;
		y >>= 1;
	}
	return Ans;
}
int a[200005], b[200005], sum[200005];
int fac[200005], inv[200005];
signed main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	fac[0] = 1;
	for (int i = 1; i <= 200000; i++) fac[i] = (fac[i-1] * i) % mod;
	for (int i = 0; i <= 200000; i++) inv[i] = quickmod (fac[i], mod - 2);
	int n = read (), m = read (), k = read ();
	if (n == 1 && m == 1) return printf ("%lld", k) & 0;
	if (n == 1) return printf ("%lld", quickmod (k, m)) & 0;
	if (m == 1) return printf ("%lld", quickmod (k, n)) & 0;
	for (int i = 1; i <= k; i++) {
		a[i] = quickmod (i, n);
	}//所有行最大值不超过 i 时方案总数
	for (int i = 1; i <= k; i++) {
		b[i] = quickmod (k - i + 1, m);
	}//所有列最小值不小于 i 时方案总数
	for (int i = k; i >= 1; i--) {
		a[i] = (a[i] - a[i-1] + mod) % mod;
	}
	for (int i = 1; i <= k; i++) {
		b[i] = (b[i] - b[i+1] + mod) % mod;
	}
//	for (int i = 1; i <= k; i++) printf ("[%lld %lld]\n", a[i], b[i]);
	for (int i = 1; i <= k; i++) sum[i] = (sum[i-1] + a[i]) % mod;
//	printf ("\n");
	int Ans = 0;
	for (int i = 1; i <= k; i++) {
		Ans = (Ans + (b[i] * sum[i])) % mod;
//		for (int j = 1; j <= i; j++) {
//			Ans = (Ans + (b[i] * a[j])) % mod;
//		}
	}
	printf ("%lld", Ans); 
	return 0;
}
/*
*/
