#include <cstdio>

using namespace std;

#define rep(i,x) for(int i=0;i<(int)(x);++i)

int nails[5005][5005];

signed main()
{
	int N, M; scanf("%d%d", &N, &M);

	rep(i, M) {
		int A, B, X; scanf("%d%d%d", &A, &B, &X);

		nails[A - 1][B - 1]++;
		nails[A - 1][B]--;
		nails[A + X][B - 1]--;
		nails[A + X][B + X + 1]++;
		nails[A + X + 1][B]++;
		nails[A + X + 1][B + X + 1]--;
	}

	rep(i, N + 2) {
		rep(j, N + 2) {
			nails[i][j + 1] += nails[i][j];
		}
	}

	rep(i, N + 2) {
		rep(j, N + 2) {
			nails[j + 1][i] += nails[j][i];
		}
	}

	rep(i, N + 2) {
		rep(j, N + 2) {
			nails[i + 1][j + 1] += nails[i][j];
		}
	}

	int ans = 0;

	rep(i, N + 2) {
		rep(j, N + 2) {
			ans += nails[i][j] > 0;
		}
	}

    printf("%d\n", ans);
}