/*
TASK: colxor
LANG: C++
*/
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#define INF 20000
#define MAXN 1024
using namespace std;

 typedef
  struct
   {
    int x,y;
   } point;

 int n,r;
 point a[MAXN];
 pair<int,int> g[MAXN];
 int x[MAXN];
 int z;
 pair<int,int> h[MAXN];
 int res;
 int dist[MAXN];
 int f[2*MAXN];
 int size;
 
 int left (pair<int,int> o)
  {
   return a[o.second].y-r+g[o.first].first+INF;
  }
 
 int right (pair<int,int> o)
  {
   return a[o.second].y-r+g[o.first].second+INF;
  }
 
 int cmpX (int p,int q)
  {
   return a[p].x<a[q].x;
  }

 int cmp (int a,int b)
  {
   if (abs(a)!=abs(b))
    return abs(a)<abs(b);
   return a>b;
  }

 int main ()
  {
   int i,j,k,l,pom,cur,last,have,er;
   scanf("%d%d",&n,&r);
   for (i=1;i<=n;i++)
    scanf("%d%d",&a[i].x,&a[i].y);
   for (i=0;i<=r;i++)
    dist[i]=(r-i)*(r-i);
   for (i=1;i<=r;i++)
    for (j=1;j<=r;j++)
     if (dist[i]+dist[j]<r*r && r*r<=dist[i-1]+dist[j-1])
      {
       g[i].first=j;
       g[i].second=2*r-j+1;
       g[2*r-i+1].first=j;
       g[2*r-i+1].second=2*r-j+1;
       break;
      }
   for (i=1;i<=n;i++)
    x[i]=i;
   sort(&x[1],&x[n+1],cmpX);
   j=1;
   for (i=-INF;i<=INF;i++)
    {
     l=0;
     for (k=1;k<=z;k++)
      if (h[k].first<2*r)
       {
        swap(h[++l],h[k]);
        h[l].first++;
       }
     z=l;                                
     while (j<=n && a[x[j]].x-r==i)
      {
       h[++z].first=1;
       h[z].second=x[j];
       j++;
      }
     size=0;
     for (k=1;k<=z;k++)
      {
       f[++size]=left(h[k]);
       f[++size]=-right(h[k]);
      }
     sort(&f[1],&f[size+1],cmp);
     pom=have=0;
     for (k=1;k<=size;k++)
      {
       cur=k;
       er=0;
       while (cur<=size && f[cur]==abs(f[k]))
        {
         pom++;
         cur++;
         er++;
        }
       if (er)
        {
         if (have)
          res+=abs(f[k])-1-last;
         last=abs(f[k])-1;
        }        
       er=0;
       while (cur<=size && f[cur]==-abs(f[k]))
        {
         pom--;
         cur++;
         er++;
        }
       if (er)
        {
         if (have)
          res+=abs(f[k])-last;
         last=abs(f[k]);
        }
       have=pom%2;
       k=cur-1;
      }
    }   
   printf("%d\n",res); 
   return 0;
  }
