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