#include <iostream>
#include <vector>
#include <algorithm>

struct Knap
{
    unsigned int a;
    unsigned int b;
};

int main()
{
    unsigned size, pyramids, vertex, sum = 0;
    Knap temp;
    std::cin >> size;
    ++size;
    std::cin >> pyramids;
    std::vector<std::vector<bool> > board;
    board.resize(size, std::vector<bool>(size, false));
    for (int i = 0; i < pyramids; ++i)
    {
        std::cin >> temp.a;
        std::cin >> temp.b;
        std::cin >> vertex;
        board[temp.a][temp.b] = true;
        unsigned int a;
        if (temp.b <= size)
            for (int a = temp.a + 1; a <= vertex + temp.a && a < size; ++a)
                board[a][temp.b] = true;
        a = temp.a;
        for (unsigned int b = temp.b + 1; a <= vertex + temp.a && a < size && b <= temp.b + vertex && b < size; ++a, ++b)
            board[a][b] = true;
        for (Knap z = {temp.a + 2, temp.b + 1}; z.a <= temp.a + vertex * 2 && z.a < size && z.b <= temp.b + vertex && z.b < size; z.a += 2, ++z.b)
            board[z.a][z.b] = true;

    }
    for (auto x : board)
        sum += std::count(x.begin(), x.end(), true);
    std::cout << sum;
    return 0;
}
