n, m, c = gets.chomp.split.map(&:to_i)
arr = gets.chomp.split.map(&:to_i)
arr2 = []
n.times{arr2 << gets.chomp.split.map(&:to_i)}
arr2.sort_by!{|c, w| -w}
sum = 0
arr2.each{|c, w|
    if arr[c-1] > 0
        arr[c-1] -= 1
        sum += w
        m -= 1
        break if m == 0
    end
}
puts sum
