import java.util.*

fun main(args:Array<String>){
    solve()
}

fun solve(){
    val (w,h,n) = readints()
    var ya = h
    var yb = 0
    var xa = w
    var xb = 0
    for(i in 0 until n){
        val (x,y,a) = readints()
        if(a == 1){
            xb = Math.max(xb,x)
        }
        else if(a == 2){
            xa = Math.min(xa,x)
        }
        else if(a == 3){
            yb = Math.max(yb,y)
        }
        else{
            ya = Math.min(ya,y)
        }
    }
    if(ya - yb < 0 || xa - xb < 0) println(0)
    else println(Math.max(0, (ya - yb) * (xa - xb)))
}

fun read() = readLine()!!
fun reads() = readLine()!!.split(" ")
fun readint() = readLine()!!.toInt()
fun readints() = readLine()!!.split(" ").map{it.toInt()}
fun readlong() = readLine()!!.toLong()
fun readlongs() = readLine()!!.split(" ").map{it.toLong()}