#include<bits/stdc++.h> #define ll long long usingnamespace std; constint N = 1000006; bool booka[(N << 1) + 10], bookb[(N << 1) + 10]; ll sum[(N << 1) + 10][2]; ll n, m, ans, x, y, cnta, cntb;
intmain(){ ios::sync_with_stdio(false); cin >> n >> m; for (int i = 1; i <= m; i++) { cin >> x >> y; ll a = x - y + N, b = x + y, s, t; if (!booka[a] && a != n - 1 + N && a != 1-n + N) { booka[a] = true; ll p = a - N; if (p >= 0) s = p + 1, t = n; else s = 1, t = p + n; ans += t - s + 1; } if (!bookb[b] && b != 2 && b != 2 * n) { bookb[b] = true; if (b >= n + 1) s = b - n, t = n; else s = 1, t = b - 1; ans += t - s + 1; } } for (int i = -n + 1; i <= n - 1; i++) { if ((i + N) % 2 == 0) { sum[i + N][0] = sum[i + N - 1][0] + booka[i + N]; sum[i + N][1] = sum[i + N - 1][1]; } else { sum[i + N][0] = sum[i + N - 1][0]; sum[i + N][1] = sum[i + N - 1][1] + booka[i + N]; } }
for (int i = 2; i <= 2 * n; i++) { if(!bookb[i]) continue; ll s, t; if (i >= n + 1) s = i - 2 * n, t = 2 * n - i; else s = 2 - i, t = i - 2; ans -= sum[t + N][i % 2] - sum[s + N - 1][i % 2]; } ans = n * n - ans; cout << ans << endl; return0; }