#include <bits/stdc++.h>
#define task "FWORD"
#define Yin ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define xD if (fopen(task".INP", "r")){freopen(task".INP", "r", stdin);freopen(task".OUT", "w", stdout);}
#define f  first
#define s second

using namespace std;

int n,k,x,m;
string str;
string st[502];
long long mu[50];
int id[502];
int d = 0;
int main()
{
    Yin xD
    cin >> n >> m >> k >> x;
    cin >> str;
    x -= 1;
    for(int i = 0;i < m;i += 1)
        cin >> st[i];
    mu[0] = 1;
    for(int i = 1;;i += 1){
        mu[i] = mu[i-1] * k;
        if(mu[i] > 1e16) break;
    }
    while(x > 0)
    {
        int y = upper_bound(mu+1,mu+50,x) - mu - 1;
        id[y] = x / mu[y];
        x = x % mu[y];
    }
    for(int i = 0;i*2 < m;i += 1){
        swap(id[i],id[m-i-1]);
//        cout << id[i] << ' ' << id[m-i-1] << '\n';
    }
    for(int i = 0;i < str.size();i += 1)
    {
        if(str[i] == '#')
        {
            cout <<st[d][id[d]];
            d += 1;
        }
        else cout << str[i];
    }
    return 0;
}
