#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	int n, m;
	cin >> n >> m;

	VVI tri( n + 1, VI() );

	REP( i, 0, tri.size() )
	{
		tri[i].resize( i + 1, 0 );
	}

	REP( i, 0, m )
	{
		int a, b, x;
		cin >> a >> b >> x;

		tri[ a - 1 ][ b - 1 ] = x + 1;
	}

	int res = 0;

	REP( i, 0, tri.size() - 1 )
	{
		REP( j, 0, tri[i].size() )
		{
			res += 0 < tri[i][j];

			tri[ i + 1 ][j] = max( tri[ i + 1 ][j], tri[i][j] - 1 );
			tri[ i + 1 ][ j + 1 ] = max( tri[ i + 1 ][ j + 1 ], tri[i][j] - 1 ); 
		}
	}

	cout << res << endl;

	return 0;
}