class Boss:
def __init__(self, data):
self.x=int(data[0])
self.y=int(data[1])
self.dx=int(data[2])
self.dy=int(data[3])
def move(self):
self.x+=self.dx
self.y+=self.dy
r,c, k =[int(x) for x in input().split()]
grid=[[False for i in range(c)] for j in range(r)]
bosses=[ Boss(input().split()) for i in range(k) ]
while len(bosses):
i = 0
while i < len(bosses):
grid[bosses[i].x][bosses[i].y]=True
bosses[i].move()
if bosses[i].x<0 or bosses[i].x>=r or bosses[i].y<0 or bosses[i].y>=c:
del bosses[i]
continue
i+=1
i = 0
ref=grid
while i < len(bosses):
if ref[bosses[i].x][bosses[i].y]:
grid[bosses[i].x][bosses[i].y]=False
del bosses[i]
continue
i+=1
ans=0
for x in grid:
for y in x:
if y:
ans+=1
print(ans)