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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int bNum[2000][2000];
int cNum[2000][2000];
int main()
{
	int H, W, N, M;
	cin >> H >> W >> N >> M;
	pairs(A)
		set<pair<int, int>> K;
	set<pair<int, int>> G;
	vector<vector<int>> B(H+1);
	vector<vector<int>> C(W + 1);
	fx(N) {
		pairsp(A);
		G.insert(A[x]);
	}

	fx(M) {
		int c, d;
		cin >> c >> d;
		K.insert(make_pair(c, d));
		B[c].push_back(d);
		C[d].push_back(c);
	}

	fx(H+1) {
		pb(B[x],0)
		pb(B[x], W+1)
		sorts(B[x]);
	}

	fx(W + 1) {
		pb(C[x], 0)
		pb(C[x], H + 1)
		sorts(C[x]);
	}
	ll ans = 0;

	fx(N) {
		auto b = lower_bound(B[A[x].first].begin(), B[A[x].first].end(), A[x].second) - B[A[x].first].begin();
		auto c = lower_bound(C[A[x].second].begin(), C[A[x].second].end(), A[x].first)- C[A[x].second].begin();
		ans += B[A[x].first][b] - B[A[x].first][b - 1] + C[A[x].second][c] - C[A[x].second][c - 1] - 2;
		bNum[A[x].first][b - 1]++;
		cNum[A[x].second][c - 1]++;
	}

	fx(H) {
		fy(W) {
			if (K.count(make_pair(x + 1, y + 1))) { continue; }
			auto b = lower_bound(B[x+1].begin(), B[x+1].end(), y+1) - B[x+1].begin();
			auto c = lower_bound(C[y+1].begin(), C[y+1].end(), x+1) - C[y+1].begin();
			ans -= max(bNum[x+1][b - 1] - 1,0);
			ans -= max(cNum[y+1][c - 1] - 1, 0);
			if (!G.count(make_pair(x+1,y+1))&& bNum[x+1][b - 1]>0&& cNum[y+1][c - 1]>0) {
				ans -= 1;
			}
		}
	}
	ce(ans-N)

    return 0;
}


//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n,m;
    cin>>n>>m;
    ll odd=0,even=0;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        int cnt=0;
        for(auto ch:s)
        {
            if(ch=='1')
                cnt++;
        }
        if(cnt%2==1)
            odd++;
        else
            even++;
    }
    cout<<odd*even<<'\n';
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}