#include <iostream>
#include <cstring>
using namespace std;
char s[1001002];
int n, num, j, i, k;
int main()
{
cin >> s >> n;
j=strlen(s);
for (i=1; i<=n; ++i)
{
cin >> num;
if (num%2==0)
{
for (k=0; k<num; ++k)
s[j++]=s[k];
}
else
{
for (k=num-1; k>=0; --k)
s[j++]=s[k];
}
}
s[j]='\0';
cout << s;
}