# 1986번. 체스
'''
주의 : 정말 bruteforce한 방법으로 구현하여
코드가 매우 김
'''n,m=map(int,input().split())box=[[0foriinrange(m)]foriinrange(n)]qList=list(map(int,input().split()))kList=list(map(int,input().split()))pList=list(map(int,input().split()))q=qList[0]k=kList[0]p=pList[0]ifq:foriinrange(q):box[qList[1+i*2]-1][qList[1+i*2+1]-1]='q'ifk:foriinrange(k):box[kList[1+i*2]-1][kList[1+i*2+1]-1]='k'ifp:foriinrange(p):box[pList[1+i*2]-1][pList[1+i*2+1]-1]='p'# 나이트
ifk:foriinrange(k):y=kList[1+i*2]-1x=kList[1+i*2+1]-1# 8칸 처리
# 위쪽
ify-1>=0andx-2>=0:ifbox[y-1][x-2]==0:box[y-1][x-2]='u'ify-1>=0andx+2<m:ifbox[y-1][x+2]==0:box[y-1][x+2]='u'ify-2>=0andx-1>=0:ifbox[y-2][x-1]==0:box[y-2][x-1]='u'ify-2>=0andx+1<m:ifbox[y-2][x+1]==0:box[y-2][x+1]='u'# 아래쪽
ify+1<nandx-2>=0:ifbox[y+1][x-2]==0:box[y+1][x-2]='u'ify+1<nandx+2<m:ifbox[y+1][x+2]==0:box[y+1][x+2]='u'ify+2<nandx-1>=0:ifbox[y+2][x-1]==0:box[y+2][x-1]='u'ify+2<nandx+1<m:ifbox[y+2][x+1]==0:box[y+2][x+1]='u'# 퀸
ifq:passList=['q','k','p']changeList=[0,'u']foriinrange(q):y=qList[1+i*2]-1x=qList[1+i*2+1]-1# 왼쪽 가로줄
l=1whileTrue:ifx-l>=0:ifbox[y][x-l]inchangeList:box[y][x-l]='u'l+=1elifbox[y][x-l]inpassList:breakelse:break# 오른쪽 가로줄
r=1whileTrue:ifx+r<m:ifbox[y][x+r]inchangeList:box[y][x+r]='u'r+=1elifbox[y][x+r]inpassList:breakelse:break# 위 세로줄
u=1whileTrue:ify-u>=0:ifbox[y-u][x]inchangeList:box[y-u][x]='u'u+=1elifbox[y-u][x]inpassList:breakelse:break# 아래 세로줄
d=1whileTrue:ify+d<n:ifbox[y+d][x]inchangeList:box[y+d][x]='u'd+=1elifbox[y+d][x]inpassList:breakelse:break# 대각선 왼쪽 위
di=1whileTrue:ify-di>=0andx-di>=0:ifbox[y-di][x-di]inchangeList:box[y-di][x-di]='u'di+=1elifbox[y-di][x-di]inpassList:breakelse:break# 대각선 오른쪽 아래
di=1whileTrue:ify+di<nandx+di<m:ifbox[y+di][x+di]inchangeList:box[y+di][x+di]='u'di+=1elifbox[y+di][x+di]inpassList:breakelse:break# 대각선 왼쪽 아래
di=1whileTrue:ify+di<nandx-di>=0:ifbox[y+di][x-di]inchangeList:box[y+di][x-di]='u'di+=1elifbox[y+di][x-di]inpassList:breakelse:break# 대각선 오른쪽 위
di=1whileTrue:ify-di>=0andx+di<m:ifbox[y-di][x+di]inchangeList:box[y-di][x+di]='u'di+=1elifbox[y-di][x+di]inpassList:breakelse:breakans=0foriinrange(n):forjinrange(m):ifbox[i][j]==0:ans+=1print(ans)