import java.util.Scanner

object Main extends App  {
  val sc = new Scanner(System.in)

  val w = sc.nextInt
  val h = sc.nextInt
  val n = sc.nextInt

  val ql = List.fill(n)(((sc.nextInt, sc.nextInt),sc.next))

  val xMin = if(ql.exists(_._2 == "1")) ql.filter(_._2 == "1").map(_._1._1).max else 0
  val xMax = if(ql.exists(_._2 == "2")) ql.filter(_._2 == "2").map(_._1._1).min else w
  val yMin = if(ql.exists(_._2 == "3")) ql.filter(_._2 == "3").map(_._1._2).max else 0
  val yMax = if(ql.exists(_._2 == "4")) ql.filter(_._2 == "4").map(_._1._2).min else h

  val res = if(xMin > xMax || yMin > yMax ) 0 else (xMax - xMin) * (yMax - yMin)

  println(res)
}
