/*
TASK:colxor
LANG:C++
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <map>

using namespace std;

long n,r,cnt=10000;

vector<long> xx,yy,rr;
vector<bool> emp(22002);
vector<vector<bool> > w(22002,emp);
//map<long, map<long,bool> > w;

int main()
{
    long i,j,k,l,x,y,xx,yy,ans=0;
    double ii;
    cin>>n>>r;

    for (y=0; y<r; y++)
     {
       ii=sqrt((double)(r*r-y*y));
       rr.push_back(ii);
       if (ii-(double)rr[rr.size()-1]>0.000001) rr[rr.size()-1]++;
     }
    
    for (k=0; k<n; k++)
     { cin>>x>>y;
       for (i=0; i<r; i++)
        for (j=-rr[i]+1; j<=rr[i]; j++)
        { l=w[i+y+cnt+1001][j+x+cnt+1001];
          if (l) { w[i+y+cnt+1001][j+x+cnt+1001]=0; ans--; }
          else { w[i+y+cnt+1001][j+x+cnt+1001]=1; ans++; }
        }
       for (i=0; i<r; i++)
        for (j=-rr[i]+1; j<=rr[i]; j++)
        { 
          l=w[y-i-1+cnt+1001][j+x+cnt+1001];
          if (l) { w[y-i-1+cnt+1001][j+x+cnt+1001]=0; ans--; }
          else { w[y-i-1+cnt+1001][j+x+cnt+1001]=1; ans++; }
        }
     }
    cout<<ans<<"\n";
   
//    system("pause");
    return 0;
}
