R,C,K = gets.chomp.split(" ").map(&:to_i)
r,c,v = K.times.map{gets.split.map(&:to_i)}.transpose
value = Array.new(R){Array.new(C,0)}
K.times do |i|
  value[r[i]-1][c[i]-1] = v[i]
end
dp0 = Array.new(R){Array.new(C,0)}
dp1 = Array.new(R){Array.new(C,0)}
dp2 = Array.new(R){Array.new(C,0)}
dp3 = Array.new(R){Array.new(C,0)}
dp0[0][0] = 0
dp1[0][0] = value[0][0]
R.times do |i|
  C.times do |j|
    if j != C-1
      tmp0 = dp0[i]
      tmp1 = dp1[i]
      tmp2 = dp2[i]
      tmp3 = dp3[i]
      tmp0[j+1] = tmp0[j] if tmp0[j+1] < tmp0[j]
      tmp1[j+1] = tmp1[j] if tmp1[j+1] < tmp1[j]
      tmp1[j+1] = tmp0[j]+value[i][j+1] if tmp1[j+1] < tmp0[j]+value[i][j+1]
      tmp2[j+1] = tmp2[j] if tmp2[j+1] < tmp2[j]
      tmp2[j+1] = tmp1[j]+value[i][j+1] if tmp2[j+1] < tmp1[j]+value[i][j+1]
      tmp3[j+1] = tmp3[j] if tmp3[j+1] < tmp3[j]
      tmp3[j+1] = tmp2[j]+value[i][j+1] if tmp3[j+1] < tmp2[j]+value[i][j+1]
    end
  end
end
puts [dp0[R-1][C-1],dp1[R-1][C-1],dp2[R-1][C-1],dp3[R-1][C-1]].max
