#include<bits/stdc++.h>
using namespace std;
char a;
string s;
int main(){
long long k=0;
int d=0;
ios::sync_with_stdio(0);
cin.tie(0);
cin>>s>>k;
for(int i=0;i<k;i++){
cin>>d;
if(d==0){
for(int j=0;j<s.size();j+=2){
a=s[j];
s[j]=s[j+1];
s[j+1]=a;
}
}
else if(d==1){
for(int j=0;j<s.size();j+=2){
if(s[j]>s[j+1]){
a=s[j];
s[j]=s[j+1];
s[j+1]=a;
}
}
}
else{
string q,w;
for(int j=0;j<s.size()/2;j++){
q[j]=s[j];
w[j]=s[j+s.size()/2];
}
for(int j=0;j<s.size();j+=2){
s[j]=q[j/2];
}
for(int j=1;j<s.size();j+=2){
s[j]=w[(j+1)/2-1];
}
}
}
cout<<s<<endl;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY2hhciBhOwpzdHJpbmcgczsKaW50IG1haW4oKXsKbG9uZyBsb25nIGs9MDsKIGludCBkPTA7Cmlvczo6c3luY193aXRoX3N0ZGlvKDApOwpjaW4udGllKDApOwogIGNpbj4+cz4+azsKICBmb3IoaW50IGk9MDtpPGs7aSsrKXsKY2luPj5kOwogICBpZihkPT0wKXsKICAgICAgZm9yKGludCBqPTA7ajxzLnNpemUoKTtqKz0yKXsKICAgICAgIAogICAgICAgIGE9c1tqXTsKICAgICAgICBzW2pdPXNbaisxXTsKICAgICAgICBzW2orMV09YTsKICAgICAgIH0KfQplbHNlIGlmKGQ9PTEpewogICAgICBmb3IoaW50IGo9MDtqPHMuc2l6ZSgpO2orPTIpewogICAgICAgCiAgICAgIGlmKHNbal0+c1tqKzFdKXsKICAgICAgICBhPXNbal07CiAgICAgICAgc1tqXT1zW2orMV07CiAgICAgICAgc1tqKzFdPWE7CiAgICAgICB9Cn0KfQplbHNlewpzdHJpbmcgcSx3Owpmb3IoaW50IGo9MDtqPHMuc2l6ZSgpLzI7aisrKXsKICAgcVtqXT1zW2pdOwogICB3W2pdPXNbaitzLnNpemUoKS8yXTsKCgp9CmZvcihpbnQgaj0wO2o8cy5zaXplKCk7ais9Mil7CnNbal09cVtqLzJdOwoKfQpmb3IoaW50IGo9MTtqPHMuc2l6ZSgpO2orPTIpewpzW2pdPXdbKGorMSkvMi0xXTsKCn0KfQp9CmNvdXQ8PHM8PGVuZGw7Cn0=