Under construction

Still being built. Things may change

Tavan

Interview

Time limit1sMemory limit32 MB

Summary
Given a pattern with # placeholders, each replaced by one of K given letters, find the Xth resulting string in alphabetical order.
Level

Medium6 of 10

Topics
Combinatorics, Greedy, Math, Implementation
Solved
No attempts yet

Problem

Zeljko was reading his grandma's old letters in the attic and found a word of length NN. Spilled ink made some of the letters unreadable, so he copied the word onto a sheet of paper and replaced each of the MM unreadable letters with the character #. His grandma looked at the sheet and gave him KK different candidate letters for every unreadable position. Zeljko wrote every word that can be built this way in his notebook, and his grandma told him that the word they are looking for is the XXth one in alphabetical order.

Zeljko had a cold on the day his class learned the alphabet, so he needs your help to find the original word.

Input

The first line contains the integers NN, MM, KK and XX (1≤N≤5001 \le N \le 500, 1≤M≤N1 \le M \le N, 1≤K≤261 \le K \le 26, 1≤X≤1091 \le X \le 10^9).

The second line contains the word of length NN that Zeljko wrote on the paper. It consists of lowercase English letters and the character #, and it contains exactly MM occurrences of #.

Each of the next MM lines contains one word of length KK. The iith of them consists of the distinct lowercase letters that can replace the iith # from the left, and those letters are not necessarily sorted alphabetically.

XX is always at most the total number of words that can be built.

Output

Print the XXth word in alphabetical order.

Hint

In the first example the words that can be built are, in alphabetical order: pololjeni, pololjeui, pololjezi, poooljeni, poooljeui, poooljezi, posoljeni, posoljeui, posoljezi.

Examples2

  1. Example 1

    Input
    9 2 3 7
    po#olje#i
    sol
    znu
    
    Expected output
    posoljeni
    
  2. Example 2

    Input
    4 1 2 2
    #rak
    zm
    
    Expected output
    zrak