//
//  a.cpp
//  
//
//  Created by Sagar Singh on 13/12/20.
//

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
typedef unsigned long long ul;
typedef long double ld;
typedef long long ll;
using namespace std;

const int nax = 1.5e3+10;
int a[nax][nax],l[nax][nax],r[nax][nax],u[nax][nax],d[nax][nax];
int n,m,p,q,ans;
int main() {
    cin >> n >> m >> p >> q;
    for(int i=0,x,y;i<p;++i){
        cin >> x >> y;
        a[x][y] = +1;
    }
    for(int i=0,x,y;i<q;++i){
        cin >> x >> y;
        a[x][y] = -1;
    }
    for(int i=1;i<=n;++i){
        int c = 0;
        for(int j=1;j<=m;++j){
            if( a[i][j] == -1 )
                c = 0;
            if( a[i][j] == +1 )
                c = 1;
            l[i][j] = c;
        }
    }
    for(int i=1;i<=n;++i){
        int c = 0;
        for(int j=m;j>=1;--j){
            if( a[i][j] == -1 )
                c = 0;
            if( a[i][j] == +1 )
                c = 1;
            r[i][j] = c;
        }
    }
    for(int j=1;j<=m;++j){
        int c = 0;
        for(int i=1;i<=n;++i){
            if( a[i][j] == -1 )
                c = 0;
            if( a[i][j] == +1 )
                c = 1;
            u[i][j] = c;
        }
    }
    for(int j=1;j<=m;++j){
        int c = 0;
        for(int i=n;i>=1;--i){
            if( a[i][j] == -1 )
                c = 0;
            if( a[i][j] == +1 )
                c = 1;
            d[i][j] = c;
        }
    }
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            ans += (l[i][j]|r[i][j]|u[i][j]|d[i][j]);
        }
    }
    cout << ans << endl;
}


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

int main()
{
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    int t[Q], a[Q], b[Q];
    for (int i = 0; i < Q; i++)
        cin >> t[i] >> a[i] >> b[i];

    char temp;
    bool f = false;
    for (int i = 0; i < Q; i++)
    {
        if (t[i] == 1)
        {
            if (f)
            {
                if (a[i] <= N)
                    a[i] += N;
                else
                    a[i] -= N;
                if (b[i] <= N)
                    b[i] += N;
                else
                    b[i] -= N;
            }
            temp = S[a[i] - 1];
            S[a[i] - 1] = S[b[i] - 1];
            S[b[i] - 1] = temp;
        }
        else
        {
            if (f)
                f = false;
            else
                f = true;
        }
    }
    if (f)
    {
        for (int i = 0; i < N; i++)
        {
            temp = S[i];
            S[i] = S[i + N];
            S[i + N] = temp;
        }
    }
    cout << S << endl;
}