#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <functional>
#include <cctype>
#include <climits> // INT_MAX ...
#include <cstring> //

using namespace std;

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;
  int ans = 3;
  if (r1 == r2 && c1 == c2) {
    ans = 0;
  } else if (r1 + c1 == r2 + c2 || r1 - c1 == r2 - c2 ||
             abs(r1 - r2) + abs(c1 - c2) <= 3) {
    ans = 1;
  } else if ((r1 + c1) % 2 == (r2 + c2) %2 || abs(r1 - r2) + abs(c1 - c2) <= 6 ||
             abs((r1 - r2) + (c1 - c2)) <= 3 || abs((r1 - r2) - (c1 - c2)) <= 3) {
    ans = 2;
  }
  cout << ans << '\n';

  return 0;
}
//#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;


#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9+7; //998244353;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}

//using mint = modint1000000007;

vector<string> ff(vector<string> iv, int c){
	int h=iv.size(), w=iv[0].size();
	auto rt=iv;
	if(c%2) rt.assign(w, string(h, ' '));
	if(c==1) rep(i,h) rep(j,w) rt[j][h-1-i] = iv[i][j];
	if(c==2) rep(i,h) rep(j,w) rt[h-1-i][w-1-j] = iv[i][j];
	if(c==3) rep(i,h) rep(j,w) rt[w-1-j][i] = iv[i][j];
	return rt;
}
void f3(vector<string>& iv){
	int h=iv.size(), w=iv[0].size();
	int lsw=0;
	rep(i, h){
		int lsw=0;
		rep(j ,w){
			if(iv[i][j]=='P') lsw=1;
			if(iv[i][j]=='B') lsw=0;
			if(lsw && iv[i][j]=='.') iv[i][j] ='T';
		}
	}
}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int h, w, n ,m;
	cin >>h >>w >>n >>m;
	vector<string> ba(h, string(w, '.'));
	rep(i, n){
		int a, b; cin >>a >>b;
		ba[a-1][b-1] ='P';
	}
	rep(i, m){
		int c, d; cin >>c >>d;
		ba[c-1][d-1] = 'B';
		
	}
	rep(i, 4){
		f3(ba);
		ba = ff(ba, 1);
	}
	
	ll ans =0;
	for(auto& xl: ba) for(auto x :xl) if(x=='P'||x=='T') ans++;
	cout << ans <<"\n";
	return 0;
}
