#include <bits/stdc++.h>

using namespace std;
//int d[5500][5500];

int main(){

	int n,m;
	scanf("%d%d",&n,&m);
	vector<int> d[n+10];
	for(int i = 0;i < n+5;i++)d[i].resize(i+10);
	for(int i = 0;i < n+5;i++)
		for(int j = 0;j < i+1;j++)
			d[i][j] = 0;
	 
	for(int i = 0;i < m;i++){
		int a,b,x;
		scanf("%d%d%d",&a,&b,&x);

		d[a][b]++;
		d[a][b+1]--;
		d[a+x+1][b]--;
		d[a+x+2][b+1]++;
		d[a+x+1][b+x+2]++;
		d[a+x+2][b+x+2]--;
	}

	for(int i = 0;i <= n;i++){
		for(int j = 1;j <= i+2;j++){
			d[i][j] += d[i][j-1];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 0;j <= i+2;j++){
			d[i][j] += d[i-1][j];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= i+2;j++){
			d[i][j] += d[i-1][j-1];
		}
	}
	int ans = 0;
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= i+2;j++){
			if(d[i][j] > 0)ans++;
		}
	}
	printf("%d\n",ans);

	return 0;
}
