local w, h, n = io.read("*n", "*n", "*n")
local l, r, t, b = 0, w, 0, h
for i = 1, n do
  local x, y, a = io.read("*n", "*n", "*n")
  if a == 1 then
    l = math.max(l, x)
  elseif a == 2 then
    r = math.min(r, x)
  elseif a == 3 then
    t = math.max(t, y)
  else
    b = math.min(b, y)
  end
end
r = math.max(l, r)
b = math.max(t, b)
print((r - l) * (b - t))
