loop do
    hp_init, hp_max = gets.split.map(&:to_i)
    break if hp_init == 0
    r, c = gets.split.map(&:to_i)
    dungeon = (1..r).map { gets.chomp.split("") }
    
    damage = {}
    gets.to_i.times do 
        c, d = gets.chomp.split
        damage[c] = d.to_i
    end
    
    dyx = {
        ?U => [-1, 0],
        ?D => [1, 0],
        ?L => [0, -1],
        ?R => [0, 1],
    }
    
    x = y = 0
    damage_seq = []
    
    gets.to_i.times do
        dir, k = gets.split
        dy, dx = dyx[dir]
        k.to_i.times do
            x += dx
            y += dy
            damage_seq << damage[dungeon[y][x]]
        end
    end
    
    potions = (1..gets.to_i).map { gets.to_i }
    
    table = (0..(1 << potions.size) - 1).map do |x|
        s = (0..potions.size-1).select {|i| x[i] == 1}.map {|i| potions[i]}.inject(:+) || 0
        [hp_init + s, hp_max].min
    end
    
    damage_seq.each do |d|
        new_table = [-Float::INFINITY] * table.size
        (0..(1 << potions.size) - 1).each do |x|
            h = table[x] - d
            if h > 0
                new_table[x] = h if h > new_table[x]
            end
            (0..potions.size-1).each do |i|
                if x[i] == 1 
                    y = x - (1 << i)
                    h = new_table[y] + potions[i]
                    h = hp_max if h > hp_max
                    new_table[x] = h if h > new_table[x]
                end
            end
        end
        table = new_table
    end
    
    puts table.any? {|h| h > 0} ? 'YES' : 'NO'

end