#include <iostream>
#include <string>
#include <vector>
using namespace std;
void reverse(vector<char>& target, int l, int r) {
while (l < r) {
int tmp = target[l];
target[l] = target[r];
target[r] = tmp;
++l, --r;
}
}
// 归并排序
void merge(vector<int>& pos1, vector<int>& pos2, vector<char>& ch1, vector<char>& ch2) {
int i = 0, j = 0;
vector<char> res;
vector<int> ires;
while (i < pos1.size() && j < pos2.size()) {
if (pos1[i] < pos2[j]) {
res.push_back(ch1[i]);
ires.push_back(pos1[i]);
++i;
}
else {
res.push_back(ch2[j]);
ires.push_back(pos2[j]);
++j;
}
}
while (i < pos1.size()) {
res.push_back(ch1[i]);
ires.push_back(pos1[i]);
++i;
}
while (j < pos2.size()) {
res.push_back(ch2[j]);
ires.push_back(pos2[j]);
++j;
}
ch1 = res;
pos1 = ires;
}
int main() {
int k1, k2, k3;
cin >> k1 >> k2 >> k3;
string str;
while (k1 != 0 && k2 != 0 && k3 != 0) {
cin >> str;
// 分别表示三组字符
vector<char> ch1;
vector<char> ch2;
vector<char> ch3;
// 分别对应下标
vector<int> pos1;
vector<int> pos2;
vector<int> pos3;
for (int i = 0; i < str.size(); ++i) {
if (str[i] <= 'i' && str[i] >= 'a') { //第一组数据
ch1.push_back(str[i]);
pos1.push_back(i);
}
else if (str[i] <= 'r' && str[i] >= 'j') { // 第二组数据
ch2.push_back(str[i]);
pos2.push_back(i);
}
else { // 第三组数据
ch3.push_back(str[i]);
pos3.push_back(i);
}
}
if (ch1.size() != 0) {
k1 = k1 % ch1.size();
reverse(ch1, ch1.size() - k1, ch1.size() - 1);
reverse(ch1, 0, ch1.size() - 1 - k1);
reverse(ch1, 0, ch1.size() - 1);
}
if (ch2.size() != 0) {
k2 = k2 % ch2.size();
reverse(ch2, ch2.size() - k2, ch2.size() - 1);
reverse(ch2, 0, ch2.size() - 1 - k2);
reverse(ch2, 0, ch2.size() - 1);
}
if (ch3.size() != 0) {
k3 = k3 % ch3.size();
reverse(ch3, ch3.size() - k3, ch3.size() - 1);
reverse(ch3, 0, ch3.size() - 1 - k3);
reverse(ch3, 0, ch3.size() - 1);
}
merge(pos1, pos2, ch1, ch2);
merge(pos1, pos3, ch1, ch3);
for (int i = 0; i < ch1.size(); ++i)
cout << ch1[i];
cout << endl;
cin >> k1 >> k2 >> k3;
}
return 0;
}