{
    ACM ICPC 2003-2004 NEERC

    Problem:    Farmer Bill's Problem
    Author:     Elena Kryuchkova
    Solution:   Maxim Babenko
}

{$APPTYPE CONSOLE}

uses
    Math;

const
    inFile = 'farmer.in';
    outFile = 'farmer.out';

    maxN = 100;
    maxC = 1000;

var
    xs, ys : integer;
    n : integer;
    x, y, r : array[1..maxN] of integer;
    x1, y1, x2, y2 : array[1..maxN] of integer;
    used : array[1..maxN] of boolean;
    answer : integer;

procedure Solve;
var
    i, j : integer;
    ax1, ay1, ax2, ay2 : integer;
    flag : boolean;

begin
    for i := 1 to n do begin
        x1[i] := x[i] - r[i];
        y1[i] := y[i] - r[i];
        x2[i] := x[i] + r[i];
        y2[i] := y[i] + r[i];
    end;
    
    fillchar(used, sizeof(used), false);
    repeat
        flag := false;
        for i := 1 to n do
            if not used[i] then
                for j := i + 1 to n do
                    if not used[j] and (max(x1[i], x1[j]) <= min(x2[i], x2[j])) and (max(y1[i], y1[j]) <= min(y2[i], y2[j])) then begin
                        ax1 := min(x1[i], x1[j]);
                        ay1 := min(y1[i], y1[j]);
                        ax2 := max(x2[i], x2[j]);
                        ay2 := max(y2[i], y2[j]);
                        x1[i] := ax1;
                        y1[i] := ay1;
                        x2[i] := ax2;
                        y2[i] := ay2;
                        used[j] := true;
                        flag := true;
                    end;
    until not flag;

    answer := xs * ys;
    for i := 1 to n do
        if not used[i] then
            answer := answer - (x2[i] - x1[i]) * (y2[i] - y1[i]);
end;

procedure ReadData;
var
    i : integer;

begin
    read(xs, ys);
    if (xs < 1) or (xs > maxC) or (ys < 1) or (ys > maxC) then
        RunError(239);

    read(n);
    if (n < 0) or (n > maxN) then
        RunError(239);

    for i := 1 to n do begin
        read(x[i], y[i], r[i]);
        if r[i] <= 0 then
            RunError(239);
        if (x[i] < r[i]) or (x[i] > xs - r[i]) or (y[i] < r[i]) or (y[i] > ys - r[i]) then
            RunError(239);
    end;
end;

procedure WriteData;
begin
    writeln(answer);
end;

begin
    ReadData;
    Solve;
    WriteData;
end.
