#include<bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define inf 1<<29
#define MAX 101
using namespace std;

int a,b,h,w,t,s,p,P[12];
string dungeon[MAX];
int grid[MAX][MAX];
pair<char,int> S[1001];
int Steps[1001];
int dp[1001][(1<<12)];
int X[4]={0,1,0,-1};
int Y[4]={-1,0,1,0};

int f(char c){
  if(c=='U')return 0;
  if(c=='R')return 1;
  if(c=='D')return 2;
  return 3;
}

int main()
{
  while(1){
    cin>>a>>b;
    if(a+b==0)break;
    cin>>h>>w;
    for(int i=0;i<h;i++){
      cin>>dungeon[i];
    }
    cin>>t;
    map<char,int> T;
    for(int i=0;i<t;i++){
      char t1;
      int t2;
      cin>>t1>>t2;
      T[t1]=t2;
    }
    cin>>s;
    for(int i=0;i<s;i++)cin>>S[i].f>>S[i].s;
    cin>>p;
    for(int i=0;i<p;i++)cin>>P[i];

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++)grid[i][j]=T[dungeon[i][j]];
    }
    int ni=0,nj=0,c=0;
    Steps[c++]=0;
    for(int i=0;i<s;i++){
      int muki=f(S[i].f);
      for(int j=0;j<S[i].s;j++){
	ni+=Y[muki];
	nj+=X[muki];
	Steps[c++]=grid[ni][nj];
      }
    }
    for(int i=0;i<c;i++){
      for(int j=0;j<(1<<p);j++)dp[i][j]=0;
    }
    for(int i=0;i<(1<<p);i++)dp[0][i]=a;
    for(int step=1;step<c;step++){
      for(int i=0;i<(1<<p);i++){
	if(dp[step-1][i]==0)continue;
	for(int j=0;j<p;j++){
	  if((i>>j)%2==0)continue;
	  int nhp=min(dp[step-1][i]+P[j],b);
	  dp[step][i-(1<<j)]=max(dp[step][i-(1<<j)],
				 max(0,nhp-Steps[step]));
	}
	dp[step][i]=max(dp[step][i],dp[step-1][i]-Steps[step]);
      }
    }
    bool flag=false;
    for(int i=0;i<(1<<p);i++){
      if(0<dp[c-1][i])flag=true;
    }
    if(flag)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  return 0;
}