#include <bits/stdc++.h>
using namespace std ;
int n, m, k, x;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if (fopen("FWORD.inp", "r")) {
        freopen("FWORD.inp", "r", stdin);
        freopen("FWORD.out", "w", stdout);
    }
    cin >> n >> m >> k >> x;
    vector<string>chu(m);
    vector<int> pos(m);
    string s;
    cin >> s;
    for (int i = 0; i < m; ++i) {
        cin >> chu[i];
        sort(chu[i].begin(), chu[i].end());
    }
    x--;
    for (int i = m - 1; i >= 0; i--) {
        pos[i] = x % k;/// pos[2]=1 pos[1]=0 pos[0]=1
        x /= k;/// 2 1 0
    }
    int res = 0;
    for (int i = 0; i < n; ++i) {
        if (s[i] == '#') {
            s[i] = chu[res][pos[res]];/// chu[0][pos[0]==1]
            res++;
        }
    }
    cout << s ;
    return 0;
}

