#include <bits/stdc++.h>
using namespace std;
const int Max = 1e3;
int n, m;
string a, b;
long long x, k;
long long fibo[Max];
void enter(){
cin >> n >> m >> a >> b >> x >> k;
}
void cal(){
fibo[1] = n, fibo[2] = m;
for(int i = 3; i < Max && fibo[i - 1] <= 1e18; i++){
fibo[i] = fibo[i - 1] + fibo[i - 2];
}
}
char solve(){
while(x > 2){
if(k > fibo[x - 1]){
k -= fibo[x - 1];
//cout << fibo[x - 1] << '\n';
x -= 2;
}
else x--;
}
k--;
if(x == 2) {
if(k >= m) return NULL;
return b[k];
}
if(k >= n) return NULL;
return a[k];
}
int main(){
enter();
cal();
char t = solve();
if(t == NULL) cout << -1;
else cout << t;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1heCA9IDFlMzsKCmludCBuLCBtOwpzdHJpbmcgYSwgYjsKbG9uZyBsb25nIHgsIGs7CmxvbmcgbG9uZyBmaWJvW01heF07CnZvaWQgZW50ZXIoKXsKICAgIGNpbiA+PiBuID4+IG0gPj4gYSA+PiBiID4+IHggPj4gazsKfQp2b2lkIGNhbCgpewogICAgZmlib1sxXSA9IG4sIGZpYm9bMl0gPSBtOwogICAgZm9yKGludCBpID0gMzsgaSA8IE1heCAmJiBmaWJvW2kgLSAxXSA8PSAxZTE4OyBpKyspewogICAgICAgIGZpYm9baV0gPSBmaWJvW2kgLSAxXSArIGZpYm9baSAtIDJdOwogICAgfQp9CgpjaGFyIHNvbHZlKCl7CiAgICB3aGlsZSh4ID4gMil7CiAgICAgICAgaWYoayA+IGZpYm9beCAtIDFdKXsKICAgICAgICAgICAgayAtPSBmaWJvW3ggLSAxXTsKICAgICAgICAgICAgLy9jb3V0IDw8IGZpYm9beCAtIDFdIDw8ICdcbic7CiAgICAgICAgICAgIHggLT0gMjsKICAgICAgICB9CiAgICAgICAgZWxzZSB4LS07CiAgICB9CiAgICBrLS07CiAgICBpZih4ID09IDIpIHsKICAgICAgICBpZihrID49IG0pIHJldHVybiBOVUxMOwogICAgICAgIHJldHVybiBiW2tdOwogICAgfQogICAgaWYoayA+PSBuKSByZXR1cm4gTlVMTDsKICAgIHJldHVybiBhW2tdOwp9CgppbnQgbWFpbigpewogICAgZW50ZXIoKTsKICAgIGNhbCgpOwogICAgY2hhciB0ID0gc29sdmUoKTsKICAgIGlmKHQgPT0gTlVMTCkgY291dCA8PCAtMTsKICAgIGVsc2UgY291dCA8PCB0OwoKfQo=