#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
using namespace std;
void Decode(string Sec,int k,int* Seq);
int main(void)
{
int k ;
int length;
string Secret;
cin >> length;
int* Sequence = new int[ length ];
for(int i = 0 ; i < length ; i++)
cin >> Sequence[i];
cin >> Secret;
cin >> k;
Decode(Secret,k,Sequence);
return 0;
}
void Decode(string Sec,int k,int* Seq)
{
size_t pos = 0;
char* Un = new char[ Sec.length() ] ;
for(int j = 1 ; j <= k ; j++)
{
for(size_t i = 0 ;i < Sec.length() ; i++)
{
for(pos = 0 ; pos < Sec.length() ; pos++)
{
if( i+1 == Seq[pos] )
{
Un[pos] = Sec[i];
break;
}
}
}
Sec.clear();
Sec.append(Un);
Sec.resize( Sec.length() / 2 );
}
cout << Sec << endl;
}