#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ ll n,m;cin>>n>>m; vcva,vb; rep(i,m){ ll x,y;cin>>x>>y; if((x+y)&1)va.pb({x,y}); else vb.pb({x,y}); } ll res=0; auto f=[&](vcv)->void{ sets,sx; for(auto [x,y]:v){ ll t=x+y-1; s.insert(t); sx.insert(x-(y-1)); } for(ll t:s){ res+=t; if(t>n)res-=2*(t-n); } vcsv(1,0); for(ll t:s)sv.pb(t); for(ll t:sx){ if(t<1)res+=n-(1-t); else res+=n+1-t; // 1<= (t+at)/2<=n at>=t (at-t)/2<=n-1 at<= 2n-2+t ll l=max(2-t,t),r=min(2*n-2+t,2*n-t); ll it=upper_bound(all(sv),r)-lower_bound(all(sv),l); res-=it; } }; f(va); f(vb); cout<