text: /*************************************************************************
  >>> Author: WindCry1
  >>> Mail: lanceyu120@gmail.com
  >>> Website: https://windcry1.com
  >>> Date: 8/9/2019 4:53:42 PM
  *************************************************************************/
  #pragma GCC optimize(2)
  #include<cstring>
  #include<cmath>
  #include<cstdio>
  #include<cctype>
  #include<cstdlib>
  #include<ctime>
  #include<vector>
  #include<iostream>
  #include<string>
  #include<queue>
  #include<set>
  #include<map>
  #include<algorithm>
  #include<complex>
  #include<stack>
  #include<bitset>
  #include<iomanip>
  #include<list>
  #if __cplusplus >= 201103L
  #include<unordered_map>
  #include<unordered_set>
  #endif
  #define ll long long
  #define ull unsigned long long
  using namespace std;
  typedef pair<int,int> pii;
  const double clf=1e-8;
  const int MMAX=0x7fffffff;
  const int INF=0xfffffff;
  const int mod=1e9+7;
  int main()
  {
  	ios::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	//freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin);
  	//freopen("C:\\Users\\LENOVO\\Desktop\\out.txt","w",stdout);
  	string s;
  	while(cin>>s)
  	{
  		map<int,int> ma;
  		int n;cin>>n;
  		while(n--)
  		{
  			int t;cin>>t;
  			ma[t]++;
  			if(ma[t]==2)
  				ma[t]=0;
  		}
  		for(map<int,int>::iterator i=ma.begin();i!=ma.end();i++)
  		{
  			if(i->second)
  				reverse(s.begin()+i->first-1,s.end()-i->first+1);
  		}
  		cout<<s<<endl;
  	}
  	return 0;
  }
  
  