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

#define se second
#define fi first
#define mk(a,b) make_pair(a,b)

typedef pair<int,int> pii;

int H,W,L,N;
int N_;
int fid[4040][4040] = {0};
long long ans = 0;
int D[4040][4040],U[4040][4040];
int mem[4040][4040];
int bit[4040];

void init()
{
    for(int i = 0; i < 4040; i++)bit[i] = 0;
    return;
}

long long sum(int i)
{
    long long res = 0;
    while(i > 0)
    {
        res += bit[i];
        i -= i & -i;
    }
    return res;
}

void update(int i)
{
    while(i <= N_)
    {
        bit[i] += 1;
        i += i & -i;
    }
    return;
}

void update(int a[4040][4040])
{
    for(int i = 1; i <= H; i++)
        for(int j = 1; j <= W; j++)
            a[i][j] = min(mem[i][j],a[i][j]);
}

int main()
{
    scanf("%d%d%d%d",&H,&W,&L,&N);
    for(int i = 0; i <= H; i++)
        for(int j = 0; j <= W; j++)U[i][j] = 10000;
    for(int i = 0; i <= H; i++)
        for(int j = 0; j <= W; j++)D[i][j] = 10000;
    for(int i = 0; i < N; i++)
    {
        int y,x;
        scanf("%d%d",&y,&x);
        fid[y][x] = 1;
    }
    memset(mem,0,sizeof(mem));
    for(int i = 1; i <= H; i++)
        for(int j = 1; j <= W; j++)
        {
            if(fid[i][j] == 1)mem[i][j] = 0;
            else mem[i][j] = mem[i][j - 1] + 1;
        }
    update(D);
    memset(mem,0,sizeof(mem));
    for(int i = 1; i <= W; i++)
        for(int j = 1; j <= H; j++)
        {
            if(fid[j][i] == 1)mem[j][i] = 0;
            else mem[j][i] = mem[j - 1][i] + 1;
        }
    update(D);
    memset(mem,0,sizeof(mem));
    for(int i = H; i > 0; i--)
        for(int j = W; j > 0; j--)
        {
            if(fid[i][j] == 1)mem[i][j] = 0;
            else mem[i][j] = mem[i][j + 1] + 1;
        }
    update(U);
    memset(mem,0,sizeof(mem));
    for(int i = W; i > 0; i--)
        for(int j = H; j > 0; j--)
        {
            if(fid[j][i] == 1)mem[j][i] = 0;
            else mem[j][i] = mem[j + 1][i] + 1;
        }
    update(U);
    /*
    for(int i = 1; i <= H + 1; i++)
    {
        for(int j = 1; j <= W + 1; j++)
        {
            printf("%d ",U[i][j]);
        }printf("\n");
    }printf("\n");
    for(int i = 1; i <= H + 1; i++)
    {
        for(int j = 1; j <= W + 1; j++)
        {
            printf("%d ",D[i][j]);
        }printf("\n");
    }printf("\n");
    */

    for(int j = 1; j <= H; j++)
    {
        vector<pii> V;
        int w = 1,h = j,now = 0;
        N_ = 0;
        while(w + N_ != W + 1 && h + N_ != H + 1)N_++;
        init();
        for(int i = 1; i <= N_; i++)
            V.push_back(mk(i - D[h + i - 1][w + i - 1] + 1,i));
        sort(V.begin(),V.end());
        //printf("%d\n",N_);
        /*
        for(int i = 0; i < V.size(); i++)
            printf(" %d %d\n",V[i].fi,V[i].se);printf("\n\n");
        */
        for(int i = 1; i <= N_; i++)
        {
            while(V.size() != now && V[now].fi == i){update(V[now].se);now++;}
            int l = U[h - 1 + i][w - 1 + i];
            if(l < L)continue;
            //printf("log = %d %d\n",l,L);
            ans += sum(i + l - 1) - sum(i + L - 2);
        }
        //printf("ans = %lld\n",ans);
    }
    for(int j = 2; j <= W; j++)
    {
        vector<pii> V;
        int w = j,h = 1,now = 0;
        N_ = 0;
        while(w + N_ != W + 1 && h + N_ != H + 1)N_++;
        init();
        for(int i = 1; i <= N_; i++)
            V.push_back(mk(i - D[h + i - 1][w + i - 1] + 1,i));
        sort(V.begin(),V.end());
        //printf("%d\n",N_);
        /*
        for(int i = 0; i < V.size(); i++)
            printf(" %d %d\n",V[i].fi,V[i].se);printf("\n\n");
        */
        for(int i = 1; i <= N_; i++)
        {
            while(V.size() != now && V[now].fi == i){update(V[now].se);now++;}
            int l = U[h - 1 + i][w - 1 + i];
            if(l < L)continue;
            //printf("log = %d %d\n",l,L);
            ans += sum(i + l - 1) - sum(i + L - 2);
        }
        //printf("ans = %lld\n",ans);
    }

    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 243868