#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk　bit目
#define vec(T) vector<T>
#define vvec(T) vector<vector<T>>
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;


template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll llINF = 1LL << 60;
const int iINF = 1e9;

//------------------------------------------------


struct Solver{

    void solve(){
        ll N;
        cin >> N;
        string S;
        cin >> S;
        ll Q;
        cin >> Q;
    
        ll flip=0;
        rep(qi,Q){
            ll ti,A,B;
            cin >>ti>> A >> B;
            if(ti==1){
                A = (A-1+N*flip)%(2*N);
                B = (B-1+N*flip)%(2*N);
                swap(S[A],S[B]);

            }else flip = 1-flip;

        }

        if(flip==0) cout << S << endl;
        else cout << S.substr(N,N) << S.substr(0,N) << endl;
 
    }
};


int main(){
    int testcasenum=1;
    //cin >> testcasenum;
    rep1(ti,testcasenum){
        Solver solver;
        solver.solve();
    }
    return 0;
}

#include<bits/stdc++.h>
typedef long long ll;
#define int long long
using namespace std;
const int p=1e4;
int read(){
    string s;cin>>s;
    int t=4;
    int f=0;
    int ans=0;
    for(auto i:s){
        if(i=='.'){
            f=1;
            continue;
        }else{
            ans=ans*10+(i-'0');
            if(f)t--;
        }
    }
    while(t){
        ans=ans*10;
        t--;
    }
    return ans;
}
signed main(){
    int X=read();
    int Y=read();
    int R=read();
    //定义横坐标左右边界
    int lc=X-R;
    int rc=X+R;
    while(lc%p)lc++;
    while(rc%p)rc--;
    //定义上下界指针; 横坐标变化的时候,只需要移动一点点上下界指针就行了.
    int up=Y,down=Y;
    while(up%p)up++;//取整
    while(down%p)down--;
    //
    int ans=0;
    for(int i=lc;i<=rc;i+=p){//枚举横坐标
        int ix=abs(X-i);
        //
        while(ix*ix+(up-Y)*(up-Y)>R*R)up-=p;//up下移
        while(up<=Y||ix*ix+(up-Y)*(up-Y)<=R*R)up+=p;//up上移到上界+1
        //
        while(ix*ix+(Y-down)*(Y-down)>R*R)down+=p;//down上移
        while(down>=Y||ix*ix+(Y-down)*(Y-down)<=R*R)down-=p;//down下移到下界-1
        //
        int add=(up-down+p-2*p)/p;//up-down+1-2就是长度.
        if(add>0)ans+=add;
    }
    cout<<ans<<endl;
    return 0;
}