{
    ACM ICPC 2003-2004 NEERC

    Problem:    Farmer Bill's Problem
    Author:     Elena Kryuchkova
    Solution:   Andrew Stankevich
}

{$APPTYPE CONSOLE}
{$DEFINE ALLOWMULTITEST}
{$O-,Q+,R+}

program farmer_bills_problem;

uses
    math;

const
    maxn = 100;

var
    x1, y1, x2, y2: array [1..maxn] of longint;
    z: array [1..maxn] of boolean;
    fx, fy: longint;
    x, y, i, j, r, n, s: longint;
    flag: boolean;

function overlap(l1, r1, l2, r2: longint): boolean;
begin
    overlap :=
        (l1 <= l2) and (l2 <= r1) or
        (l1 <= r2) and (r2 <= r1) or
        (l2 <= l1) and (l1 <= r2) or
        (l2 <= r1) and (r1 <= r2);
end;

begin
    if eoln then runerror(239);
    read(fx);
    if eoln then runerror(239);
    read(fy);
    if not eoln then runerror(239);
    readln;
    if eoln then runerror(239);
    read(n);
    if not eoln then runerror(239);
    readln;

    if (fx < 1) or (fx > 1000) then runerror(239);
    if (fy < 1) or (fy > 1000) then runerror(239);
    if (n < 0) or (n > 100) then runerror(239);

    for i := 1 to n do
    begin
        if eoln then runerror(239);
        read(x);
        if eoln then runerror(239);
        read(y);
        if eoln then runerror(239);
        read(r);
        if not eoln then runerror(239);
        readln;

        if (r <= 0) then runerror(239);
        if (x - r < 0) or (x + r > fx) or (y - r < 0) or (y + r > fy) then runerror(239);

        x1[i] := x - r;
        x2[i] := x + r;
        y1[i] := y - r;
        y2[i] := y + r;
        z[i] := true;
    end;
    {$IFNDEF ALLOWMULTITEST}
    if not eof then runerror(239);
    {$ENDIF}

    flag := true;
    while flag do
    begin
        flag := false;
        for i := 1 to n do
            for j := i + 1 to n do
                if z[i] and z[j] then
                begin
                    if overlap(x1[i], x2[i], x1[j], x2[j]) and overlap(y1[i], y2[i], y1[j], y2[j]) then
                    begin
                        x1[i] := min(x1[i], x1[j]);
                        y1[i] := min(y1[i], y1[j]);
                        x2[i] := max(x2[i], x2[j]);
                        y2[i] := max(y2[i], y2[j]);
                        z[j] := false;
                        flag := true;
                    end;
                end;
    end;

    s := 0;
    for i := 1 to n do
        if z[i] then
            s := s + (x2[i] - x1[i]) * (y2[i] - y1[i]);

    writeln(fx * fy - s);


    close(input);
    close(output);
end.