import scala.collection.mutable

object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val Array(n, m, c) = readLine.trim.split(' ').map(_.toInt)
  val limits = readLine.trim.split(' ').map(_.toInt)
  val queue = mutable.PriorityQueue()(Ordering.by[(Int, Int), Int](_._2))
  for (_ ← 0 until n){
    val Array(color, weight) = readLine.trim.split(' ').map(_.toInt)
    queue.enqueue((color - 1, weight))
  }
  var sum = 0
  for (_ ← 0 until m){
    while (queue.nonEmpty && limits(queue.head._1) == 0) {
      queue.dequeue()
    }
    if (queue.nonEmpty){
      val (color, weight) = queue.dequeue()
      limits(color) -= 1
      sum += weight
    }
  }
  println(sum)
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
