#include<iostream>

using namespace std;

int N, M;
int ruisekiwa[5050][5050];

int main() {
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		ruisekiwa[a][b]++;
		ruisekiwa[a][b + 1]--;
		ruisekiwa[a + c + 1][b]--;
		ruisekiwa[a + c + 2][b + 1]++;
		ruisekiwa[a + c + 1][b + c + 2]++;
		ruisekiwa[a + c + 2][b + c + 2]--;
	}
	
	//???????????¢????´???????
	for (int i = 0; i <= N + 10; i++) {
		for (int j = 1; j <= N + 10; j++) {
			ruisekiwa[i][j] += ruisekiwa[i][j - 1];
		}
	}
	
	//??????????????????????´???????
	for (int i = 1; i <= N + 10; i++) {
		for (int j = 0; j <= N + 10; j++) {
			ruisekiwa[i][j] += ruisekiwa[i - 1][j];
		}
	}
	
	//??????????????????????´???????
	for (int i = 1; i <= N + 10; i++) {
		for (int j = 1; j <= i; j++) {
			ruisekiwa[i][j] += ruisekiwa[i - 1][j - 1];
		}
	}

	int ans = 0;
	for (int i = 0; i <= N + 10; i++) {
		for (int j = 0; j <= N + 10; j++) {
			if (ruisekiwa[i][j] > 0)ans++;
		}
	}
	cout << ans << endl;
	return 0;
}