import Control.Monad
import Data.List
main=do
 [w,h,n]<-map read.words<$>getLine
 list<-replicateM n (map read.words<$>getLine)
 print$(max 0 ((min w (xa [x!!0|x<-list,x!!2==2]))-(xi [x!!0|x<-list,x!!2==1])))*(max 0 ((min h (ya [y!!1|y<-list,y!!2==4]))-(yi [y!!1|y<-list,y!!2==3])))
  where xa list = if list==[] then 100 else head(sort list)
        xi list = if list==[] then 0 else last(sort list)
        ya list = if list==[] then 100 else head(sort list)
        yi list = if list==[] then 0 else last(sort list)