const main = (txt: any): void => {
  const input = txt.split('\n')
  let [W, H, N] = input[0].split(' ').map((i: string) => { return Number(i) })
  let Ma1 = 0
  let Ma2 = W
  let Ma3 = 0
  let Ma4 = H
  for (let i = 1; i <= N; i++) {
    let x: number
    let y: number
    let a: number
    [x, y, a] = input[i].split(' ').map((i: string) => { return Number(i) })
    if (a === 1 && x > Ma1) {
      Ma1 = x
    }
    if (a === 2 && x < Ma2) {
      Ma2 = x
    }
    if (a === 3 && y > Ma3) {
      Ma3 = y
    }
    if (a === 4 && y < Ma4) {
      Ma4 = y
    }
  }
  const sum = (Ma2 - Ma1) * (Ma4 - Ma3)
  if (sum >= 0) {
    console.log(sum)
  }
  else {
    console.log('0')
  }
}


main(require('fs').readFileSync('/dev/stdin', 'utf8'));