#include
#include
#include
using namespace std;
int main() {
int n;
scanf("%d", &n);
bool a[n][n];
memset(a, true, sizeof(a));
int m;
scanf("%d", &m);
for (int k = 0; k < m; ++k) {<br> int x, y, aa;
scanf("%d%d%d", &x, &y, &aa);
for (int i = x; i < min(x + aa, n + 1); ++i) {<br> for (int j = y; j < min(y + aa, n + 1); ++j) {<br> a[i][j] = false;
}
}
}
int cnt = 0;
for (int i = 0; i < n; i++) {<br> for (int j = 0; j < n; j++) {<br> if (a[i][j]) {
cnt++;
}
}
}
printf("%d", cnt);
return 0;
}