#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <unordered_set>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define P pair<ll, ll>
using namespace std;

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}



int main(){
  int n, m, k; cin >> n >> m >> k;
  mint ans = 0, sum = 0;
  for(int i = 1; i <= k; i++){
    mint a = i, b = k-i+1;
    mint x = a.pow(n) - (a-1).pow(n);
    mint y = b.pow(m);
    if(n == 1){
      y = mint(k).pow(m) - mint(k-i).pow(m);
      y -= sum;
      sum += y;
    }
    if(m == 1) y = 1;
    ans += x * y;
    // cout << i << "-------------" << endl;
    // cout << x << "," << y << endl;
    // cout << ans << endl;
  }
  cout << ans << endl;
  return 0;
}

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

// 2の27乗＝１億３千万
#define rep(i, n, N) for (int i = n; i < (int)(N); i++)
#define ascending(array) sort(array.begin(), array.end());
#define descending(array) sort(array.rbegin(), array.rend());
#define log(name, message) cout << name << " = " << message << endl
#define out(content) cout << content << endl
#define max(array) *max_element(array.begin(), array.end())
#define min(array) *min_element(array.begin(), array.end())

int main() {
  int n;
  string s;
  int q;
  cin >> n >> s >> q;
  vector<int> t(q), a(q), b(q);
  rep(i, 0, q) { cin >> t[i] >> a[i] >> b[i]; }
  bool reverse = false;
  rep(i, 0, q) {
    if (t[i] == 1) {
      if (reverse) {
        if (a[i] > n) {
          a[i] = a[i] - n;
        } else {
          a[i] = a[i] + n;
        }
        if (b[i] > n) {
          b[i] = b[i] - n;
        } else {
          b[i] = b[i] + n;
        }
      }
      int order1 = a[i] - 1;
      int order2 = b[i] - 1;
      string first = {s[order1]};
      string second = {s[order2]};
      int last = s.size() - 1;
      string test = {s[last]};
      s.pop_back();
      s += test;
      s.replace(order1, 1, second);
      s.replace(order2, 1, first);
    } else {
      reverse = !reverse;
    }
  }
  if (reverse) {
    s = s.substr(n) + s.substr(0, n);
  }
  out(s);
}
