H,W,K=map(int,input().split()) MAP=[[0]*W for _ in range(H)] for _ in range(K): x,y,v=map(int,input().split()) x-=1 y-=1 MAP[x][y]=v sousa=[[0]*W for _ in range(H)] for i in range(H): for j in range(W): for x in range(H): for y in range(W): if not(x+y>=i+j and x-y>=i-j): continue sousa[i][j]+=MAP[x][y] ans=0 for i in range(H): ans+=sum(sousa[i]) print(ans)