/*--------------------------------------------------------------*/
/* ACM ICPC 2009-2010, NEERC                                    */
/* Northern Subregional Contest                                 */
/* St Petersburg, October 17, 2009                              */
/*--------------------------------------------------------------*/
/* Problem C. Circles on a Screen                               */
/*                                                              */
/* Original idea         Georgiy Korneev                        */
/* Problem statement     Oleg Davydov                           */
/* Testset               Oleg Davydov                           */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Sergey Kopeliovich                     */
/*--------------------------------------------------------------*/
 
#include <cmath>
#include <cstdio>
#include <cstring>

#include <algorithm>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define mp make_pair

const int maxn = 100;

int W, H, n, x[maxn], y[maxn], r[maxn];

struct event
{
  int t, dx;

  event() { } 
  event( int t_, int dx_ ) : t(t_), dx(dx_) { }

  bool operator < ( const event &a ) const { return t < a.t; }
};

int en;
event e[maxn * 2 + 2];

int sqr( int x ) { return x * x; }

int main()
{
  freopen("circles.in", "r", stdin);
  freopen("circles.out", "w", stdout);

  scanf("%d%d%d", &W, &H, &n);
  forn(i, n)
    scanf("%d%d%d", &x[i], &y[i], &r[i]);

  int sum = 0;
  forn(cx, W)
  {
    en = 0;
    forn(i, n)
    {
      if (x[i] - r[i] <= cx && cx <= x[i] + r[i])
      {
        int d = (int)(sqrt((double) (sqr(r[i]) - sqr(cx - x[i]))) + 1e-9);
        e[en++] = event(max(y[i] - d, 0), +1);
        e[en++] = event(min(y[i] + d + 1, H), -1);
      }   
    }
    e[en++] = event(0, 0);
    e[en++] = event(H, 0);
    sort(e, e + en);

    int cnt = 0;
    forn(i, en - 1)
      if ((cnt += e[i].dx) == 0)
        sum += e[i + 1].t - e[i].t;
  }
  printf("%d\n", sum);
  return 0;
}
