import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)

    val w, h, n = sc.nextInt()
    var up = h
    var down = 0
    var left = 0
    var right = w

    for (i <- 0 until n) {
      val x, y, a = sc.nextInt()
      a match {
        case 1 => left = math.max(left, x)
        case 2 => right = math.min(right, x)
        case 3 => down = math.max(down, y)
        case 4 => up = math.min(up, y)
      }
    }

    val width = math.max(0, right - left)
    val height = math.max(0, up - down)

    println(width * height)

  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}
