#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

H,W,M=get_i
grid=array(W,0,H)
M.times do|i|
    h,w=get_i
    h-=1
    w-=1
    grid[h][w]=1
end
l=array(W+1,0,H)
r=array(W+1,0,H)
H.times do|i|
    W.times do|j|
      l[i][j+1]=grid[i][j]+l[i][j]
      r[i][W-j-1]=grid[i][W-1-j]+r[i][W-j]
    end
end
t=array(W,0,H+1)
b=array(W,0,H+1)
W.times do|j|
    H.times do|i|
      t[i+1][j]=grid[i][j]+t[i][j]
      b[H-1-i][j]=grid[H-1-i][j]+b[H-i][j]
    end
end
ans=0
H.times do|i|
    W.times do|j|
      v=l[i][j+1]+r[i][j]+t[i+1][j]+b[i][j]-grid[i][j]*3
      ans=max(v,ans)
    end
end
puts ans