/* How To Solve It
 1st. Understanding The Problem
    未知なもの、データ(与件), 条件 は何か？
    その条件は未知を決定するために十分か？
    条件を分解せよ, 図を描け
 2nd. Devising A Plan
    類似、関連のある問題、典型問題を知らないか？
    役立ちそうな定理やアルゴリズムを知らないか？
    問題の一部を解決できるか、一部だけ残して他を切り捨ててみろ
    既知のものやデータを変えることはできるか？
 3rd. Carrying Out The Plan
    各ステップで誤りがないか、正しいと説明できるか？
 4th. Looking Back
    別解、他の問題に使えそうなものはあるか？
*/
/*{{{ #include */
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <tuple>
#include <algorithm>
#include <utility>
#include <cmath>/*}}}*/
/*{{{ namespace R2357 */
namespace R2357 {
    inline void IN(void){return;}
    template<class F,class... R>inline void IN(F& f,R&... r){std::cin>>f;IN(r...);}
    template <class T>inline void OUT(T x){std::cout<<x<<'\n';}
    template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
    template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
    template<class T=int>T read(){
        T x=0; char c;
        while(((c=getchar())>'9'||c<'0')&&c!='-');
        const bool f=(c=='-')&&(c=getchar());
        while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
        return f?-x:x;
    }
    template<class T>std::istream& operator>>(std::istream& is,std::vector<T>& V){
        for(auto& v:V)is>>v; return is;
    }
    template<class T1,class T2>
    std::istream& operator>>(std::istream& is,std::pair<T1,T2>& P){
        return is>>P.first>>P.second;
    }
    template<class T>inline T ceil_div(T a,T b){
    	return (a+(b-1))/b;
    }
    namespace debug {
        using namespace std;
        void Write(void){cerr<<endl;}
        template<class F,class...R>void Write(F f,R...r){cerr<<' '<<f;Write(r...);}
        template<class T>void Write(vector<T>& V,int n=-1){
            if(n==-1) n = V.size();
            for(int i=0;i<n;i++)cerr<<' '<<V[i]; cerr<<endl;
        }
        template<class T,class U> void Write(pair<T,U>& p){cerr<<' '<<'{'<<p.first<<','<<p.second<<'}'<<endl;}
        #include <cxxabi.h>
        template<class T>string TypeName(T& x){
            return string(abi::__cxa_demangle(typeid(T).name(), 0, 0, 0));
        }
    }
}/*}}}*/
/*{{{ using */
using namespace std; using namespace R2357;
using ll=long long; using ld=long double;
using pint=pair<int,int>;/*}}}*/
/*{{{ #define */
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define each(x,v) for(auto& x:v)
#define el '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define Unique(x) sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end())
#define Fill(v,n) fill(v,v+sizeof(v)/sizeof(*v),n)
#define max_element(x) *max_element(x.begin(),x.end())
#define min_element(x) *min_element(x.begin(),x.end())
#define INF 1073741824 // 2e30
#define INFL 2305843009213693952ll // 2e61
#define _FASTIO_ ios::sync_with_stdio(false),cin.tie(nullptr);
/*}}}*/

/* NOTE
 0.
*/
// using namespace debug;

int main(){ _FASTIO_
    int a, b; IN(a, b);
    if(abs(a-b) < 3) OUT("Yes");
    else OUT("No");
    return 0;
}

#include <bits/stdc++.h>
#define fi first
#define se second
#define o2(x) (x) * (x)
#define mk make_pair
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset((a), (b), sizeof((a)))
#define rep(i,s,t) for(register int i=s;i<t;++i)
#define per(i,s,t) for(register int i=s;i>=t;--i)
#define GKD std::ios::sync_with_stdio(false);cin.tie(0)
#define my_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())
using namespace std;
typedef long long LL;
typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> pii;
// mt19937 rng(time(NULL));
// mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 generator(std::clock());
// shuffle(arr, arr + n, generator);
inline int64 read() {
    int64 x = 0;int f = 0;char ch = getchar();
    while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch =
    getchar(); return x = f ? -x : x;
}
inline void write(int64 x, bool f = true) {
    if (x == 0) {putchar('0'); if(f)putchar('\n');else putchar(' ');return;}
    if (x < 0) {putchar('-');x = -x;}
    static char s[23];
    int l = 0;
    while (x != 0)s[l++] = x % 10 + 48, x /= 10;
    while (l)putchar(s[--l]);
    if(f)putchar('\n');else putchar(' ');
}
int lowbit(int x) { return x & (-x); }
template <class T>
T big(const T &a1, const T &a2) {return a1 > a2 ? a1 : a2;}
template <class T>
T sml(const T &a1, const T &a2) {return a1 < a2 ? a1 : a2;}
template <typename T, typename... R>
T big(const T &f, const R &... r) {return big(f, big(r...));}
template <typename T, typename... R>
T sml(const T &f, const R &... r) {return sml(f, sml(r...));}
void debug_out() { cout << '\n'; }
template <typename T, typename... R>
void debug_out(const T &f, const R &... r) {
    cout << f << " ";
    debug_out(r...);
}
#ifdef LH_LOCAL
#define debug(...) cout << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__);
#else
#define debug(...) ;
#endif
/*================Header Template==============*/
const int INF = 0x3f3f3f3f;
const int mod = 998244353;// 998244353
const int MXN = 1500 + 5;
const int MXE = 2e6 + 5;
int n, m, h, w;
int mp[MXN][MXN];
vector<pii> col[MXN], row[MXN];
int main() {
#ifdef LH_LOCAL
    freopen("D:in.txt", "r", stdin);
    //freopen("D:out.txt", "w", stdout);
#endif
    n = read(), m = read(), h = read(), w = read();
    rep(i, 0, h) {
        int x = read(), y = read();
        row[x].eb(mk(y, 1));
        col[y].eb(mk(x, 1));
        mp[x][y] = 1;
    }
    rep(i, 0, w) {
        int x = read(), y = read();
        row[x].eb(mk(y, -1));
        col[y].eb(mk(x, -1));
        mp[x][y] = -1;
    }
    rep(i, 1, n + 1) sort(all(row[i]));
    rep(j, 1, m + 1) sort(all(col[j]));
    int ans = 0;
    rep(i, 1, n + 1) {
        rep(j, 1, m + 1) {
            if(mp[i][j] == 1) ++ ans;
            if(mp[i][j]) continue;
            int flag = 0;
            ans += flag;
            pii tmp = mk(j, 0);
            int p = lower_bound(all(row[i]), tmp) - row[i].begin();
            if(p < (int)row[i].size() && row[i][p].se == 1) flag = 1;
            -- p;
            if(p >= 0 && p < (int)row[i].size() && row[i][p].se == 1) flag = 1;
            tmp = mk(i, 0);
            p = lower_bound(all(col[j]), tmp) - col[j].begin();
            if(p < (int)col[j].size() && col[j][p].se == 1) flag = 1;
            -- p;
            if(p >= 0 && p < (int)col[j].size() && col[j][p].se == 1) flag = 1;
            ans += flag;
        }
    }
    printf("%d\n", ans);
#ifdef LH_LOCAL
    cout << "time cost:" << 1.0 * clock() / CLOCKS_PER_SEC << "s" << endl;
    // system("pause");
#endif
    return 0;
}
