#include<bits/stdc++.h>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

int R,C,HPinit,HPmax,T,S,P,cost[30],iG[200][200],p[12],dp[1<<12];
char G[200][200];

int main(){
  while( cin >> HPinit >> HPmax, HPinit | HPmax){
    cin >> R >> C;
    rep(i,R) rep(j,C) cin >> G[i][j];
    cin >> T;
    rep(i,T) {
      char c; 
      cin >> c;
      cin >> cost[c-'A'];
    }
    rep(i,R) rep(j,C) iG[i][j] = cost[G[i][j]-'A'];
    cin >> S;
    deque<int> damage;
    int x = 0,y = 0;
    rep(i,S){
      char dir;
      int n, dx = 0, dy = 0;
      cin >> dir >> n;
      if( dir == 'U' )      dy--;
      else if( dir == 'D' ) dy++;
      else if( dir == 'R' ) dx++;
      else                  dx--;
      rep(_,n){
        x += dx, y += dy;
        assert( 0 <= x && x < C && 0 <= y && y < R );
        if( iG[y][x] != 0 ) damage.push_back(iG[y][x]);
      }
    }
    cin >> P;
    rep(i,P) cin >> p[i];
    assert((int)damage.size() <= 1000);
    rep(i,(1<<P)) dp[i] = 0;
    dp[0] = HPinit;
    rep(i,(int)damage.size()){
      rep(j,(1<<P))if(dp[j]>0){
        rep(k,P)if( !( (j>>k) & 1 ) ){
          dp[j|(1<<k)] = max(dp[j|(1<<k)],
                             min(HPmax,dp[j]+p[k]));
        }
      }
      rep(j,(1<<P)) dp[j] -= damage[i];
    }
    bool ok = false;
    rep(i,(1<<P)) if( dp[i] > 0 ) {
      ok = true;
      break;
    }
    cout << (ok?"YES":"NO") <<endl;
  }
  return 0;
}