import java.util.Scanner

object Main {

  val scan = new Scanner(System.in)

  def main(args: Array[String]): Unit = {
    val W = scan.nextInt()
    val H = scan.nextInt()
    val T = scan.nextInt()
    val p = scan.nextInt()
    val g = Array.ofDim[Int](H, W)
    for (i <- 0 until p) {
      val x = scan.nextInt()
      val y = scan.nextInt()
      val t = scan.nextInt()
      g(y)(x) += 1
    }
    var sum = 0
    for (i <- 0 until H; j <- 0 until W) {
      val s = scan.nextInt()
      sum += s * g(i)(j)
    }
    println(s"${sum}")
  }

}