#include <iostream>
#include <vector>
using namespace std;

vector<vector<int>> nails;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	
	nails.resize(n + 2);
	for(int i = 0; i < n + 2; ++i)
		nails[i].assign(i + 2, 0);
	
	for(int i = 0; i < m; ++i){
		int a, b, x;
		cin >> a >> b >> x;
		--a, --b;
		nails[a][b]++;
		nails[a][b + 1]--;
		nails[a + x + 1][b]--;
		nails[a + x + 2][b + 1]++;
		nails[a + x + 1][b + x + 2]++;
		nails[a + x + 2][b + x + 2]--;
	}
	
	for(int i = 0; i < n; ++i){
		for(int j = 0; j <= i; ++j){
			nails[i][j + 1] += nails[i][j];
		}
	}
	
	for(int i = 0; i < n; ++i){
		for(int j = 0; j <= i; ++j){
			nails[i + 1][j] += nails[i][j];
		}
	}
	
	for(int i = 0; i < n; ++i){
		for(int j = 0; j <= i; ++j){
			nails[i + 1][j + 1] += nails[i][j];
		}
	}
	
	int ans = 0;
	for(int i = 0; i < n; ++i){
		for(int j = 0; j <= i; ++j){
			if(nails[i][j] > 0)
				ans++;
		}
	}

	cout << ans << endl;
	
	return 0;
}