#include <bits/stdc++.h>
#define ll long long
#define name "FWORD"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);if(fopen(name".INP","r")){freopen(name".INP","r",stdin);freopen(name".OUT","w",stdout);}
using namespace std;
string v1[1001];
ll n,m,k,x;
int main(){
    fast
    cin>>n>>m>>k>>x;
    string s;
    cin>>s;
    for(ll i=0;i<m;i++){
        cin>>v1[i];
        sort(v1[i].begin(),v1[i].end());
    }
    vector<ll>v;
    for(ll i=0;i<n;i++){
        if(s[i]=='#'){
            v.push_back(i);
        }
    }
    x--;
    for(ll i=m-1;i>=0;i--){
        s[v[i]]=v1[i][x%k];
        x/=k;
    }
    cout<<s;
}
