import java.util.*
import kotlin.math.*

fun main(args: Array<String>) {
    val (w, h, n) = readIntList()
    val c = List(n) { readIntList() }

    var lx = 0
    var rx = w
    var ly = 0
    var uy = h
    c.forEach { (x, y, a) ->
        when (a) {
            1 -> lx = max(lx, x)
            2 -> rx = min(rx, x)
            3 -> ly = max(ly, y)
            4 -> uy = min(uy, y)
        }
    }
    if (rx - lx <= 0 || uy - ly <= 0) {
        println(0)
        return
    }
    println((rx - lx) * (uy - ly))
}

// read
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)