let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (W, H, N) = (input[0], input[1], input[2])
var (minX, minY, maxX, maxY) = (0, 0, W, H)
for _ in 0..<N {
    let input = readLine()!.characters.split(" ").map{Int(String($0))!}
    let (x, y, a) = (input[0], input[1], input[2])
  	switch a {
    case 1:
        minX = max(minX, x)
    case 2:
        maxX = min(maxX, x)
    case 3:
        minY = max(minY, y)
    case 4:
        maxY = min(maxY, y)
    default:
      	break
    }
}
print((maxX-minX) * (maxY-minY))