#include<bits/stdc++.h>
using namespace std;
int main(){

	string s;
	int m;
	cin >> s;
	cin >> m;

	int x[m];
	memset(x,0,sizeof(x));
	for(int i = 0; i < m; i++){
		int c;
		cin >> c;
		c--;
		x[c]++;
		x[s.length()-c]--;

	}
	int c = 0;
	for(int i = 0; i < s.length(); i++){
		c+=x[i];
		cout << (s[c&1 ? s.length()-i-1:i]);
	}
}


#include<bits/stdc++.h>
using namespace std;
int main(){

	string s;
	int m;
	cin >> s;
	cin >> m;

	int x[m];
	memset(x,0,sizeof(x));
	for(int i = 0; i < m; i++){
		int c;
		cin >> c;
		//c--;
		x[(c - 1)]++;
		x[s.length()-(c-1)]--;

	}
	int c = 0;
	for(int i = 0; i < s.length(); i++){
		c+=x[i];
		cout << (s[c&1 ? s.length()-i-1:i]);
	}
}


#include<bits/stdc++.h>
using namespace std;
int main(){

	string s;
	int m;
	cin >> s;
	cin >> m;
	int n = s.length();
	int x[n];
	memset(x,0,sizeof(x));

	while(m--){
		int c;
		cin >> c;
		x[c-1]++;
	}
	int c = 0;
	for(int i = 0; i < n / 2; i++){
		c += x[i];

		if(c&1) swap(s[i],s[n-i-1]);
	}

	cout << s;

}


#include <bits/stdc++.h>
using namespace std;
int m, k, i, l, b[100005];
string s;
int main()
{
	cin >> s >> m;
	l = s.size();
	for(int i = 1; i <= m; ++ i)
	{
		cin >> k;
		b[k]++;
		b[k] = b[k]%2;
	}
	for(i=1; i<=l; i++)
	{
		b[i] += b[i-1];
		b[i] = b[i]%2;
	}
	for(int i = 1; i <= l/2; i++)
		if(b[i])
			swap(s[i-1],s[l -i]);
	cout << s;
}


#include<bits/stdc++.h>
using namespace std;
int a[100010], n, i, l;
string s;
string f(int k, int m, string c)
{
    int y, l, t, r, j;
    t = c.size() - 1;
    cout << t;
    if(t / 2 > k)
        r = t / 2;
    else
        r = k;
    for(j=k; j<=r; j++)
    {
        swap(c[j], c[t-j]);
    }
    return c;
}
int main()
{
    cin >> s >> n;
    l = s.size() - 1;
    for(i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i] = a[i] - 1;
        s = f(a[i], l - a[i], s);
    }
    cout << s;
}


#include <bits/stdc++.h>
using namespace std;
long long m, k, i, l, b[300000];
string s;
int main()
{
	cin >> s >> m;
	l = s.size();
	for(int i = 1; i <= m; ++ i)
	{
		cin >> k;
		b[k]++;
		b[k] = b[k]%2;
	}
	for(i=1; i<=l; i++)
	{
		b[i] += b[i-1];
		b[i] = b[i]%2;
	}
	for(int i = 1; i <= l/2; i++)
		if(b[i])
			swap(s[i-1],s[l -i]);
	cout << s;
}


#include<bits/stdc++.h>
using namespace std;
int a[100010], n, i, l;
string s;
string f(int k, int m, string c)
{
    int y, l, t, r, j;
    t = c.size() - 1;
    if(t / 2 > k)
        r = t / 2;
    else
        r = k;
    for(j=k; j<=r; j++)
    {
        swap(c[j], c[t-j]);
    }
    return c;
}
int main()
{
    cin >> s >> n;
    l = s.size() - 1;
    for(i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i] = a[i] - 1;
        s = f(a[i], l - a[i], s);
    }
    cout << s;
}


#include<bits/stdc++.h>
using namespace std;
int a[100010], n, i, l;
string s;
string f(int k, int m, string c)
{
    int l, t, r, j;
    //cout << k<< '/' << m;
    t = c.size() - 1;
    if(m / 2 > k)
        r = m / 2;
    else
        r = k;
    for(j=k; j<=r; j++)
            swap(c[j], c[t-j]);
    return c;
}
int main()
{
    cin >> s >> n;
    l = s.size() - 1;
    for(i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i] = a[i] - 1;
        s = f(a[i], l - a[i], s);
    }
    cout << s;
}


#include<bits/stdc++.h>
using namespace std;
int a[100010], n, i, l;
string s;
string f(int k, int m, string c)
{
    int l, j = 0;
    for(j=k; j<=m / 2; j++)
        if(k)
            swap(c[j], c[m-j+1]);
        else
            swap(c[j], c[m-j]);
    return c;
}
int main()
{
    cin >> s >> n;
    l = s.size() - 1;
    for(i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i] = a[i] - 1;
        s = f(a[i], l - a[i], s);
    }
    cout << s;
}


#include<bits/stdc++.h>
using namespace std;
#include<vector>
#define ll long long
ll bin(ll a[],ll n ,ll i,ll x)
{
     ll l=i,r=n;
     ll m=0;
     while(l<=r)
     {
          m=(l+r)/2;
          if(a[m]>x)
          r=m-1;
          else if(a[m]<x)
          l=m+1;
          else
          return 0;
     }
     return 1;
}
ll a[100005],b[100005];
int main()
{
     int  n,m,i=0,j=0,l,r,g=0,x;
     string s;
     cin>>s;
     scanf("%d",&n);
     m=s.length();
     for(i=1;i<=n;i++)
     {
          scanf("%d",&l);
          a[l-1]++;
          a[m-l]++;
     }
     for(i=1;i<=m/2;i++)
     a[i]+=a[i-1];
     for(i=0;i<m/2;i++)
     {
          if(a[i]%2)
          swap(s[i],s[m-i-1]);
     }
     cout<<s;

}


#include<bits/stdc++.h>
using namespace std;
#include<vector>
#define ll long long
ll bin(ll a[],ll n ,ll i,ll x)
{
     ll l=i,r=n;
     ll m=0;
     while(l<=r)
     {
          m=(l+r)/2;
          if(a[m]>x)
          r=m-1;
          else if(a[m]<x)
          l=m+1;
          else
          return 0;
     }
     return 1;
}
ll a[100005],b[100005];
int main()
{
     long long n,m,i=0,j=0,l,r,g=0,x;
     string s;
     cin>>s>>n;
     m=s.length();
     for(i=1;i<=n;i++)
     {
          cin>>l;
          reverse(s.begin()+l-1,s.begin()+(m-l+1));
     }
     cout<<s;

}


#include<bits/stdc++.h>
using namespace std;
#include<vector>
#define ll long long
ll bin(ll a[],ll n ,ll i,ll x)
{
     ll l=i,r=n;
     ll m=0;
     while(l<=r)
     {
          m=(l+r)/2;
          if(a[m]>x)
          r=m-1;
          else if(a[m]<x)
          l=m+1;
          else
          return 0;
     }
     return 1;
}
ll a[100005],b[100005];
int main()
{
     int  n,m,i=0,j=0,l,r,g=0,x;
     string s;
     cin>>s;
     scanf("%d",&n);
     m=s.length();
     for(i=1;i<=n;i++)
     {
          scanf("%d",&l);
          reverse(s.begin()+l-1,s.begin()+(m-l+1));
     }
     cout<<s;

}


#include<bits/stdc++.h>
using namespace std;
#include<vector>
#define ll long long
ll bin(ll a[],ll n ,ll i,ll x)
{
     ll l=i,r=n;
     ll m=0;
     while(l<=r)
     {
          m=(l+r)/2;
          if(a[m]>x)
          r=m-1;
          else if(a[m]<x)
          l=m+1;
          else
          return 0;
     }
     return 1;
}
ll a[200005],b[200005];
int main()
{
     int  n,m,i=0,j=0,l,r,g=0,x;
     string s;
     cin>>s;
     scanf("%d",&n);
     m=s.length();
     for(i=1;i<=n;i++)
     {
          scanf("%d",&l);
          a[l-1]++;
          a[m-l]++;
     }
     for(i=1;i<=m/2;i++)
     a[i]+=a[i-1];
     for(i=0;i<m/2;i++)
     {
          if(a[i]%2)
          swap(s[i],s[m-i-1]);
     }
     cout<<s;

}


#include<bits/stdc++.h>
using namespace std;
#include<vector>
#define ll long long
ll bin(ll a[],ll n ,ll i,ll x)
{
     ll l=i,r=n;
     ll m=0;
     while(l<=r)
     {
          m=(l+r)/2;
          if(a[m]>x)
          r=m-1;
          else if(a[m]<x)
          l=m+1;
          else
          return 0;
     }
     return 1;
}
ll a[100005],b[100005];
int main()
{
     int  n,m,i=0,j=0,l,r,g=0,x;
     string s;
     cin>>s;
     scanf("%d",&n);
     m=s.length();
     for(i=1;i<=n;i++)
     {
          scanf("%d",&l);
          a[l-1]++;
          a[m-l]++;
     }
     for(i=1;i<=m/2;i++)
     a[i]+=a[i-1];
     for(i=0;i<=m/2;i++)
     {
          if(a[i]%2)
          swap(s[i],s[m-i-1]);
     }
     cout<<s;

}


#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define pb push_back
#define all(ar) ar.begin(),ar.end()

using namespace std;
using ll = long long;
using ld = long double;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string st; int si,m; cin>>st>>m; si = st.size();
	for(int i = 0; i < m; i++){
		int x,n,sg; cin>>x; sg = (si - x); n =(1 + (sg - n))/2;
		for(int j = 0; j < n; j++){
			swap(st[(x+j)-1],st[sg-j]);
		}
	}
	cout<<st el;
	return 0;
}


/*
					.m.
*/

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define all(ar) ar.begin(),ar.end()
#define pb push_back
#define pii pair<int,int>

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
const ll mxr = 1e5 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m; string st; cin>>st>>m; n = st.size();
	while(m--){
	 int a,la,s; cin>>a;
	 la = n - a + 1;s = (la - a + 1)/2;
	 for(int i = 0; i < s; i++){
	 	//cout<<(a-1)+i sp<< n - (a+i) el;
	 	swap(st[(a-1)+i],st[n-(a+i)]);
	 }
	 //cout<<st el;
	}
	cout<<st el;
  return 0;
}


/*
					.m.
*/

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define all(ar) ar.begin(),ar.end()
#define pb push_back
#define pii pair<int,int>

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
const ll mxr = 1e5 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m; string st; cin>>st>>m; n = st.size();
	int ar[n]; memset(ar,0,sizeof(ar));
	while(m--){
	 int x; cin>>x;
	 ar[--x] += 1;
	}
	int k = n;
	n /= 2;
	for(int i = 0; i < n; i++){
	 if(i != 0) ar[i] += ar[i-1];
	 if(ar[i]%2) swap(st[i],st[k-i-1]);
	}
	cout<<st el;
  return 0;
}


/*
					.m.
*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define all(ar) ar.begin(),ar.end()
#define pb push_back
#define pii pair<int,int>

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
const ll mxr = 1e5 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m; string st; cin>>st>>m; n = st.size();
	while(m--){
	 int a,la,s; cin>>a;
	 la = n - a + 1;s = (la - a + 1)/2;
	 for(int i = 0; i < s; i++){
	 	//cout<<(a-1)+i sp<< n - (a+i) el;
	 	swap(st[(a-1)+i],st[n-(a+i)]);
	 }
	 //cout<<st el;
	}
	cout<<st el;
  return 0;
}


/*
					.m.
*/

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define all(ar) ar.begin(),ar.end()
#define pb push_back
#define pii pair<int,int>

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
const ll mxr = 1e5 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, m; string st; cin>>st>>m; n = st.size();
	while(m--){
	 int a,la,s; cin>>a;
	 la = n - a + 1;s = (la - a + 1)/2;
	 for(int i = 0; i < s; i++){
	 	//cout<<(a-1)+i sp<< n - (a+i) el;
	 	swap(st[(a-1)+i],st[n-(a+i)]);
	 }
	 //cout<<st el;
	}
	cout<<st el;
  return 0;
}


/*
					.m.
*/

#include "iostream"
#include "algorithm"
#include "iomanip"
#include "vector"
#include "set"
#include "sstream"
#include "fstream"
#include "cstring"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "bitset"
#include "cassert"
#include "deque"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define all(ar) ar.begin(),ar.end()
#define pb push_back
#define pii pair<int,int>

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;
const ll mxr = 1e5 + 5;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m; string st; cin>>st>>m; n = st.size();
	int ar[n]; memset(ar,0,sizeof(ar));
	while(m--){
	 int x; cin>>x;
	 ar[--x] += 1;
	}
	int k = n;
	n /= 2;
	for(int i = 0; i < n; i++){
	 if(ar[i]%2) swap(st[i],st[k-i-1]);
	}
	cout<<st el;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Faast ios_base::sync_with_stdio(0);       cin.tie(0);      cout.tie(0);
#define SIZE 10
const int MOD = 1e9 + 7;

int main()
{

    Faast;

    string s; cin>>s;
    int m,ind[100002]={}; cin>>m;
    while(m--)
    {
        int a; cin>>a;
        ind[a-1]++;
    }
    int temp=0;
    for(int i=0; i<s.size()/2; ++i)
    {
        temp+=ind[i];
        if(temp&1) swap(s[i],s[s.size()-i-1]);
    }
    cout<<endl<<s;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Faast ios_base::sync_with_stdio(0);       cin.tie(0);      cout.tie(0);
#define SIZE 10
const int MOD = 1e9 + 7;

int main()
{

    Faast;

    string s; cin>>s;
    int m,ind[100002]; cin>>m;
    while(m--)
    {
        int a; cin>>a;
        ind[a-1]++;
    }
    int temp=0;
    for(int i=0; i<s.size()/2; ++i)
    {
        temp+=ind[i];
        if(temp&1) swap(s[i],s[s.size()-i-1]);
    }
    cout<<endl<<s;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Faast ios_base::sync_with_stdio(0);       cin.tie(0);      cout.tie(0);
#define SIZE 10
const int MOD = 1e9 + 7;

int main()
{

    Faast;

    string s; cin>>s;
    int m; cin>>m;
    while(m--)
    {
        int a; cin>>a;
        vector<char>v;
        for(int i=a-1; i<=s.size()-a; ++i)
        {
            v.push_back(s[i]);
        }
        for(int i=a-1,j=v.size()-1; i<=s.size()-a,j>=0; ++i,--j)
        {
            s[i]=v[j];
        }
    }
    cout<<endl<<s;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Accepted ios_base::sync_with_stdio(0);       cin.tie(0);      cout.tie(0);
#define SIZE 10
const int MOD = 1e9 + 7;
int main()
{

    Accepted;

    string s; cin>>s;
    int m; cin>>m;
    while(m--)
    {
        int a; cin>>a;
        string rev;
        rev=s.substr(a-1,(s.size()-a+1)-a-1+2);
        reverse(rev.begin(), rev.end());
        s.replace(a-1,rev.size(),rev);
    }
    cout<<endl<<s;

    return 0;
}


#include<iostream>
#include<iomanip>
#include <functional>
#include <algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<list>
#include <string>
#include<math.h>

using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;

// int x = string
// stoi(string as number) ;
/*
	int -> char
	simply add '0' to int
	//char c = m + '0' ;
	//s+= c ;
*/

/*
	Reverse Element
	reverse(a + L, a + R + 1);
*/

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s ;
	int m, a;
	cin >> s ;
	string ttt = s.substr(4);
	cin >> m ;
	forn(i,m) {
		cin >> a ;
		int t = a;
		a-- ;
		string first = s.substr(0,a);
		//string temp = s.substr(a,s.size()-(t+1)+1);
		string mid = "" ;
		for ( int j = a ; j < s.size()-t+1 ; j++ )
			mid += s[j] ;
		//string temp = s.substr(a,s.size()-t+1);
		string second = s.substr(s.size()-(t+1)+2,s.size()-1);
		reverse(mid.begin(),mid.end()) ;
		s.clear() ;
		//s = first + mid + second ;
		s += first ;
		s += mid ;
		s += second;
	}
	cout << s << endl;

	return 0;
}


//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <math.h>
using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pil pair<int,long long>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-9
#define PI acos(-1.0);
//  fabs(a - b) < eps [1e-9]
/*
struct point
{
	double x, y;
	point() {
		x = y = 0;
	}

	point(double xx, double yy) {
		x = xx;
		y = yy;
	}

};

double dis(point p1, point p2)
{
	// double res = hypot(p1.x - p2.x, p1.y - p2.y);
	double res = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
	return res;
}

point flowers[2005];
double fn1Distance[2005], fn2Distance[2005];
*/

int a[100005];
int n, k;
map<int,int> mpp;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s;
	cin >> s;

	int m;
	vector<int> freq(s.size());
	set<int> ss;
	cin >> m;
	int temp = m;
	while (m--)
	{
		int n ;
		cin >> n;
		n--;
		mpp[n]++;
	}

	for (auto j : mpp) {
		if (j.second % 2 == 0)
			continue;
		for (int i = j.first; i <= s.size()-1-j.first; i++) {
			freq[i]++;
		}
	}

	for (int i = 0; i < freq.size(); i++) {
		if (freq[i] % 2 == 0) {
			cout << s[i];
		} else {
			cout << s[s.size()-1-i];
		}
	}

	cout << endl;

	return 0;
}


//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <math.h>
using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pil pair<int,long long>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-9
#define PI acos(-1.0);
//  fabs(a - b) < eps [1e-9]
/*
struct point
{
	double x, y;
	point() {
		x = y = 0;
	}

	point(double xx, double yy) {
		x = xx;
		y = yy;
	}

};

double dis(point p1, point p2)
{
	// double res = hypot(p1.x - p2.x, p1.y - p2.y);
	double res = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
	return res;
}

point flowers[2005];
double fn1Distance[2005], fn2Distance[2005];
*/

int a[100005];
int n, k;
map<int,int> mpp;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s;
	cin >> s;

	int m;
	vector<int> freq(s.size());
	set<int> ss;
	cin >> m;
	int temp = m;
	while (m--)
	{
		int n ;
		cin >> n;
		n--;
		mpp[n]++;
	}

	for (auto j : mpp) {
		if (j.second % 2 == 0)
			continue;
		for (int i = j.first; i <= s.size()-1-j.first; i++) {
			freq[i]++;
		}
	}

	string news = "" ;
	for (int i = 0; i < freq.size() / 2; i++) {
		if (freq[i] % 2 == 0) {
			continue;
		} else {
			//cout << s[s.size()-1-i];
			swap(s[i], s[s.size()-1-i]);
		}
	}

	cout << s <<  endl;

	return 0;
}


//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <math.h>
using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pil pair<int,long long>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-9
#define PI acos(-1.0);
//  fabs(a - b) < eps [1e-9]
/*
struct point
{
	double x, y;
	point() {
		x = y = 0;
	}

	point(double xx, double yy) {
		x = xx;
		y = yy;
	}

};

double dis(point p1, point p2)
{
	// double res = hypot(p1.x - p2.x, p1.y - p2.y);
	double res = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
	return res;
}

point flowers[2005];
double fn1Distance[2005], fn2Distance[2005];
*/

int a[100005];
int n, k;
map<int,int> m;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s;
	cin >> s;

	int m;
	vector<int> freq(s.size());
	cin >> m;
	while (m--)
	{
		int n ;
		cin >> n;
		n--;
		for (int i = n; i <= s.size()-1-n; i++) {
			freq[i]++;
		}
	}

	for (int i = 0; i < freq.size(); i++) {
		if (freq[i] % 2 == 0) {
			cout << s[i];
		} else {
			cout << s[s.size()-1-i];
		}
	}

	cout << endl;
	return 0;
}


//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <math.h>
using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pil pair<int,long long>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-9
#define PI acos(-1.0);
//  fabs(a - b) < eps [1e-9]
/*
struct point
{
	double x, y;
	point() {
		x = y = 0;
	}

	point(double xx, double yy) {
		x = xx;
		y = yy;
	}

};

double dis(point p1, point p2)
{
	// double res = hypot(p1.x - p2.x, p1.y - p2.y);
	double res = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
	return res;
}

point flowers[2005];
double fn1Distance[2005], fn2Distance[2005];
*/

const int N = 2e5 + 5;
int a[100005];
int n, k;
map<int,int> mpp;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s;
	cin >> s;

	int m;
	vector<int> freq(N);
	cin >> m;
	int temp = m;
	while (m--)
	{
		int n ;
		cin >> n;
		n--;
		freq[n]++;
	}

	for (int i = 0; i < s.size() / 2; i++) {
		if (i != 0) {
			freq[i] += freq[i-1];
		}
		if (freq[i] & 1) {
			swap(s[i], s[s.size()-1-i]);
		}
	}

	cout << s <<  endl;

	return 0;
}


#include<iostream>
#include<iomanip>
#include <functional>
#include <algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<list>
#include <string>
#include<math.h>

using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;

// int x = string
// stoi(string as number) ;
/*
	int -> char
	simply add '0' to int
	//char c = m + '0' ;
	//s+= c ;
*/

/*
	Reverse Element
	reverse(a + L, a + R + 1);
*/

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s ;
	int m, a;
	cin >> s ;
	cin >> m ;
	forn(i,m) {
		cin >> a ;
		int t = a;
		a-- ;
		string first = s.substr(0,a);
		//string temp = s.substr(a,s.size()-(t+1)+1);
		string mid = "" ;
		for ( int j = a ; j < s.size()-t+1 ; j++ )
			mid += s[j] ;
		//string temp = s.substr(a,s.size()-t+1);
		string second = s.substr(s.size()-(t+1)+2,s.size()-1);
		reverse(mid.begin(),mid.end()) ;
		s.clear() ;
		//s = first + mid + second ;
		s += first ;
		s += mid ;
		s += second;
	}
	cout << s << endl;

	return 0;
}


//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <functional>
#include <sstream>
#include <algorithm>
#include <queue>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <math.h>
using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pil pair<int,long long>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define eps 1e-9
#define PI acos(-1.0);
//  fabs(a - b) < eps [1e-9]
/*
struct point
{
	double x, y;
	point() {
		x = y = 0;
	}

	point(double xx, double yy) {
		x = xx;
		y = yy;
	}

};

double dis(point p1, point p2)
{
	// double res = hypot(p1.x - p2.x, p1.y - p2.y);
	double res = (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
	return res;
}

point flowers[2005];
double fn1Distance[2005], fn2Distance[2005];
*/

int a[100005];
int n, k;
map<int,int> m;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s;
	cin >> s;

	int m;
	vector<int> freq(s.size());
	set<int> ss;
	cin >> m;
	int temp = m;
	while (m--)
	{
		int n ;
		cin >> n;
		n--;
		ss.insert(n);

	}

	for (auto j : ss) {
		for (int i = j; i <= s.size()-1-j; i++) {
			freq[i]++;
		}
	}

	for (int i = 0; i < freq.size(); i++) {
		if (freq[i] % 2 == 0) {
			cout << s[i];
		} else {
			cout << s[s.size()-1-i];
		}
	}

	cout << endl;

	return 0;
}


#include<iostream>
#include<iomanip>
#include <functional>
#include <algorithm>
#include<queue>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<list>
#include <string>
#include<math.h>

using namespace std ;

typedef long long ll ;
typedef vector<int> vi;
typedef vector<string> vs;

// int x = string
// stoi(string as number) ;
/*
	int -> char
	simply add '0' to int
	//char c = m + '0' ;
	//s+= c ;
*/

/*
	Reverse Element
	reverse(a + L, a + R + 1);
*/

#define fx(n) fixed<<setprecision(n)
#define OO 1e10
#define NOO -1e3
#define pii pair<int,int>
#define pid pair<int,double>
#define pll pair<long long,long long>
#define mp make_pair
#define forn(i, a) for (int i = 0;i < a;i++)
#define forn1(i, a) for (int i = 1;i <= a;i++)

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);

	string s ;
	int m, a;
	cin >> s ;
	string ttt = s.substr(4);
	cin >> m ;
	forn(i,m) {
		cin >> a ;
		int t = a;
		a-- ;
		string first = s.substr(0,a);
		//string temp = s.substr(a,s.size()-(t+1)+1);
		string mid = "" ;
		for ( int j = a ; j < s.size()-t+1 ; j++ )
			mid += s[j] ;
		//string temp = s.substr(a,s.size()-t+1);
		string second = s.substr(s.size()-(t+1)+2,s.size()-1);
		reverse(mid.begin(),mid.end()) ;
		s.clear() ;
		//s = first + mid + second ;
		s += first ;
		s += mid ;
		s += second;
	}
	cout << s << endl;

	system("pause");
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> sum(s,size(), 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    for(int i = 0; i < n; i++) {
        for(int j = (s.size()/2-1); j >= a[i]; j--) {
            sum[j]++;
        }
    }
    for(int i = 0; i < (s.size()/2); i++) {
        if(sum[i]%2 == 1) {
            swap(s[i], s[s.size()-1-i]);
        }
    }
    cout << s;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    if(n%2 == 0) {
        int i = 0;
        for(i = 0; i < n; i+=2) {
            for(int j = min(a[i],a[i+1]); j < max(a[i], a[i+1]); j++) {
                swap(s[j], s[s.size()-j-1]);
            }
        }
    } else {
        int i = 0;
        for(i = 0; i < n-1; i+=2) {
            for(int j = min(a[i],a[i+1]); j < max(a[i], a[i+1]); j++) {
                swap(s[j], s[s.size()-j-1]);
            }
        }
        for(int j = a[i]; j < s.size()/2; j++) {
            swap(s[j],s[s.size()-j-1]);
        }
    }
    cout << s;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> sum(s.size(), 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    for(int i = 0; i < n; i++) {
        for(int j = (s.size()/2-1); j >= a[i]; j--) {
            sum[j]++;
        }
    }
    for(int i = 0; i < (s.size()/2); i++) {
        if(sum[i]%2 == 1) {
            swap(s[i], s[s.size()-1-i]);
        }
    }
    cout << s;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> sum(n, 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
    }

    for(int i = 0; i < n; i++) {
        for(int j = (s.size()/2-1); j >= a[i]; j--) {
            sum[j]++;
        }
    }
    for(int i = 0; i < s.size()/2; i++) {
        if(sum[i]%2 == 1) {
            swap(s[i], s[s.size()-1-i]);
        }
    }
    cout << s;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(s.size(), 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        a[i]--;
        b[a[i]]++;
    }
    int sum = 0;
    for(int i = 0; i < (s.size()/2); i++) {
        sum += b[i];
        if(sum%2 == 1) {
            swap(s[i], s[s.size()-1-i]);
        }
    }
    cout << s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int m;
    cin>>m;
    int n = s.size();
    int a;
    s = " "+s;
    long long sum[3000001];
    sum[0]=0;
    while(m--){
        cin>>a;
        sum[a]++;
    }
    for(int i=1;i<=n/2;i++){
        sum[i]+=sum[i-1];
    }
    for(int i=1;i<=n/2;i++){
        if(sum[i]%2) swap(s[i],s[n-i+1]);
    }
    s.erase(s.begin());
    cout<<s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int m;
    cin>>m;
    int n = s.size();
    int a;
    s = " "+s;
    long long sum[3000001];
    sum[0]=0;
    while(m--){
        cin>>a;
        sum[a]++;
    }
    for(int i=1;i<n/2;i++){
        sum[i]+=sum[i-1];
    }
    for(int i=1;i<n/2;i++){
        if(sum[i]%2) swap(s[i],s[n-i+1]);
    }
    s.erase(s.begin());
    cout<<s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int m;
    cin>>m;
    int a;
    while(m--){
        cin>>a;
        reverse(s.begin()+a-1,s.begin()+s.length()-a+1);
    }
    cout<<s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int m;
    cin>>m;
    int n = s.size();
    int a;
    s = " "+s;
    int sum[100001];
    sum[0]=0;
    while(m--){
        cin>>a;
        sum[a]++;
    }
    for(int i=1;i<n/2;i++){
        sum[i]+=sum[i-1];
    }
    for(int i=1;i<n/2;i++){
        if(sum[i]%2) swap(s[i],s[n-i+1]);
    }
    s.erase(s.begin());
    cout<<s;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    int m;
    cin>>m;
    int n = s.size();
    int a;
    s = " "+s;
    int sum[100001];
    sum[0]=0;
    while(m--){
        cin>>a;
        sum[a]++;
    }
    for(int i=1;i<=n/2;i++){
        sum[i]+=sum[i-1];
    }
    for(int i=1;i<=n/2;i++){
        if(sum[i]%2) swap(s[i],s[n-i+1]);
    }
    s.erase(s.begin());
    cout<<s;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin>>s;

	int m;
	cin>>m;
	while (m--){
	  long  int t;
	    cin>>t;
	   long int l=t-1;
	   long int r= s.length()-l-1;
	    while (l<r){
	        swap(s[l++],s[r--]);

	    }
	}
	cout<<s;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin>>s;
	int n= s.size();
	int sum[n];
	int m;
	cin>>m;
	while (m--){
	   long  int t;
	    cin>>t;
	    sum[--t]++;
	   sum[n-t]++;
	    }
	    for (int i=1;i<n/2;i++)
	        sum[i]+=sum[i-1];
	   for(int i=0;i<n/2;i++){
	       if (sum[i]%2 !=0)
	        swap(s[i],s[n-i-1]);
	   }

	cout<<s;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin>>s;
	int n= s.size();
	int sum[n];
	int m;
	cin>>m;
	while (m--){
	   long  int t;
	    cin>>t;
	    sum[--t]++;
	   sum[n-t-1]++;
	    }
	    for (int i=1;i<n/2;i++)
	        sum[i]+=sum[i-1];
	   for(int i=0;i<n/2;i++){
	       if (sum[i]%2 !=0)
	        swap(s[i],s[n-i-1]);
	   }

	cout<<s;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	string s;
	cin>>s;
	int n= s.size();
	int sum[n]={0};
	int m;
	cin>>m;
	while (m--){
	   long  int t;
	    cin>>t;
	    sum[--t]++;
	   sum[n-t]++;
	    }
	    for (int i=1;i<n/2;i++)
	        sum[i]+=sum[i-1];
	   for(int i=0;i<n/2;i++){
	       if (sum[i]%2 !=0)
	        swap(s[i],s[n-i-1]);
	   }

	cout<<s;
	return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

int fr[100009];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    //clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    bool _true = 0;
    for(int i =0; i*2<n; i++)
    {
            if(fr[i]&1)
            {
                swap(s[i], s[n-i-1]);
            }
            fr[i+1]+=fr[i];
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

ll fr[3*1000000];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    lp(i, n)
    {
        if(fr[i]&1)
        {
            int l = i, r = n-i-1 ;
            while(r>l)
            {swap(s[l],s[r]);l++;r--;}
        }
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

int fr[100009];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    //clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    for(int i = 0; i*2<=n; i++)
    {
        if(fr[i]&1)
        {
            int l = i, r = n-i-1 ;
            while(r>l)
            {swap(s[l],s[r]);l++;r--;}
        }
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

int fr[100009];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    //clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    bool _true = 0;
    for(int i = 0; i*2<n; i++)
    {
        if(fr[i]&1)
        {
            _true = !_true;
        }
        if(_true)
            swap(s[i], s[n-i-1]);
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

int fr[100009];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    //clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    bool _true = 0;
    for(int i = 1; i*2<n; i++)
    {
            fr[i]+=fr[i-1];
            if(fr[i]&1)
            {
                swap(s[i], s[n-i-1]);
            }
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

ll fr[3*1000000];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s);
    for(int i = 0; i*2<=n; i++)
    {
        if(fr[i]&1)
        {
            int l = i, r = n-i-1 ;
            while(r>l)
            {swap(s[l],s[r]);l++;r--;}
        }
    }
    cout<<s<<"\n";
    return 0;
}


#include <cstdint>
#include <string>
#include<bits/stdc++.h>
#define inn freopen("in.in","r",stdin)
#define outt freopen("out.out","w",stdout)
#define llp(n) for(ll i=n-1;i>=0;i--)
#define lp(i,n) for(int i=0;i<(int)n;i++)
#define lpa(i,a,n) for(ll i=(a);i<(ll)n;i++)
#define INF -1000000000
#define clr(v,d) memset(v,d,sizeof (v))
#define sz(v) ((int)(v.size()))
#define all(v) ((v).begin()), ((v).end())
#define sf scanf
#define pf printf
#define inf (~0ULL>>2)
#define eps (1e-10)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)

template<class T> using min_q = std::priority_queue<T, std::vector<T>, std::greater<T>>; //Minimum priority queue
int comp_double(double a, double b)
{
    if(fabs(a-b) <= eps)
        return 0;
    //if() -1;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
typedef std::vector<int> vi;
typedef std::vector<bool> vib;
typedef std::vector<std::vector<int>> vii;

//typedef pair<int, int> ii;
//typedef vector<ll> vii;
//vector_::fill(all(v),0)

using namespace std;

const int MOD = 1000000000;

bool is_C_S(char f)
{
    return f >= 'a' && f <= 'z';
}

template<typename T>
void primefactors(T n)
{
    while(n%2==0)
    {
        cout<<2<<" ";
        n/=2;
    }
    for(T i = 3; i*i<=n; i++)
    {
        while(n%i==0)
        {
            cout<<i<<" ";
            n/=i;
        }
    }
    if(n>2)
        cout<<n<<"\n";
}
vector<bool> prime;
void sprime()
{
    prime.resize(50);
    fill(all(prime),1);
    prime[0]=prime[1] = 0;
    for (int p=2; p*p<=50; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<50; i+=p)
                prime[i] = false;
        }
    }
}

template<typename T>
T power(T p, T b)
{
    if(p==0)
        return 1;
    return b*power(p-1,b);
}
int primes[4] = {2, 3, 5, 7};
int n;
int inc_exe(int i = 0, int d = 1, int sign = 1)
{
    if(i == 4)
    {
        return sign * (n/d);
    }
    return inc_exe(i+1,d,sign) + inc_exe(i+1,d*primes[i], sign*-1);
}
template<class T>
T gcd(T a,T  b)
{
    if(a%b)
        return gcd(b, a%b);
    else
    {
        //b%2==0?b--:b;
        return b;
    }
}
ull n_p_mod_5(ull n, ull p)
{
    n%=5;
    ull res = 1%5;

    while(p)
    {
        if(p&1)
            {
                res = (res*n)%5;
                p--;
            }

        else
            {
                p>>=1;
                n*=n%5;
            }
    }
    return res;
}
int dx[]= {1,-1,0,0,1,-1,1,-1};
int dy[]= {0,0,-1,1,1,-1,-1,1};

ll fr[3*1000000];
//ll vals[1000000];
int m,a;
int main()
{
    //inn;
    //outt;
    ios
    string s;
    clr(fr, 0);
    cin>>s>>m;
    while(m--)
    {
        cin>>a;
        fr[a-1]++;
    }
    n = sz(s)/2;
    lp(i, n)
    {
        if(fr[i]&1)
        {
            int l = i, r = n-i-1 ;
            while(r>l)
            {swap(s[l],s[r]);l++;r--;}
        }
    }
    cout<<s<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

main()
{
    long long int i,m,x,p,q,j;
    string abc;
    cin>>abc;
    x=abc.length();
    cin>>m;
    for(i=0;i<m;i++)
    {
        cin>>p;
        q=x-p+1;
        p--;
        q--;
        start:
            {
                swap(abc[p],abc[q]);
                p++;
                q--;
                if(q-p>=1)
                    goto start;
            }
    }
    cout<<abc<<endl;
}


#include<bits/stdc++.h>
using namespace std;

main()
{
    long long int i,m,x,p,q,j;
    string abc;
  //  char xyz[2*1000000];
    cin>>abc;
    x=abc.length();
 //   cout<<x<<endl;
    cin>>m;
    long long int a[m+10];
    for(i=0;i<m;i++)
        cin>>a[i];
    for(i=0;i<m;i++)
    {
      //  cout<<"loop"<<endl;
        p=a[i];
        q=x-a[i]+1;
        p--;
        q--;
    //    cout<<abc[p]<<" "<<abc[q]<<endl;

    /* //    cout<<p<<" "<<q<<endl;
   // for(j=0;j<x;j++)
    //    xyz[j]='NULL';
        for(j=p;j<=q;j++)
            {
                xyz[j]=abc[j];
            }
       for(j=p;j<=q;j++)
            {
                cout<<j<<abc[j];
            }
            cout<<endl;
    */
      //  l=p;
      //  k=q;
    //   cout<<"start"<<endl;
        start:
            {
             //   cout<<abc[p]<<" "<<abc[q]<<endl;
                swap(abc[p],abc[q]);
                p++;
                q--;
             //   l++;
                if(q-p>=1)
                    goto start;
            }
         ///   cout<<abc<<endl;
    }
    cout<<abc<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int p,q;
string abc;
void rec(int u, int v, string xyz)
{
    if(q-p<0 || p==q)
        return;
    swap(abc[p],abc[q]);
    p++;
    q--;
    rec(p,q,abc);
}
main()
{
    int i,m,x;
    cin>>abc;
    x=abc.length();
    cin>>m;
    for(i=0;i<m;i++)
    {
        cin>>p;
        q=x-p+1;
        p--;
        q--;
        rec(p,q,abc);
    }
    cout<<abc<<endl;
}


#include<bits/stdc++.h>
using namespace std;

main()
{
    long long int i,m,x,p,q,j;
    string abc;
  //  char xyz[2*1000000];
    cin>>abc;
    x=abc.length();
 //   cout<<x<<endl;
    cin>>m;
    long long int a[m+10];
  //  for(i=0;i<m;i++)
       // cin>>a[i];
    for(i=0;i<m;i++)
    {
      //  cout<<"loop"<<endl;
       // p=a[i];
       cin>>p;
        q=x-p+1;
        p--;
        q--;
    //    cout<<abc[p]<<" "<<abc[q]<<endl;

    /* //    cout<<p<<" "<<q<<endl;
   // for(j=0;j<x;j++)
    //    xyz[j]='NULL';
        for(j=p;j<=q;j++)
            {
                xyz[j]=abc[j];
            }
       for(j=p;j<=q;j++)
            {
                cout<<j<<abc[j];
            }
            cout<<endl;
    */
      //  l=p;
      //  k=q;
    //   cout<<"start"<<endl;
        start:
            {
             //   cout<<abc[p]<<" "<<abc[q]<<endl;
                swap(abc[p],abc[q]);
                p++;
                q--;
             //   l++;
                if(q-p>=1)
                    goto start;
            }
         ///   cout<<abc<<endl;
    }
    cout<<abc<<endl;
}


#include<bits/stdc++.h>
#include<string.h>
using namespace std;
main()
{
    long long int m,i,p,q,x,r,y;
    string str;
    cin>>str;
    cin>>m;
    long long int a[m+100];
    for(i=0;i<m;i++)
        cin>>a[i];
    ///sort(a,a+m);
    x=str.length();
   //cout<<"chk"<<endl;
    vector <int> lst[x+100];
    for(i=0;i<m;i++)
    {
        p=a[i];
        lst[p].push_back(p);
    }
    r=0;
  ///  long long int b[m+100];
    for(i=1;i<=(x/2);i++)
    {
        q=i-1;
     ///   cout<<"chk"<<endl;
        y=lst[i].size();
        y=y+r;
       /// cout<<q<<endl;
        if(y%2==1&& y>0)
        {
        ///cout<<"chk"<<endl;
     ///   cout<<q<<" "<<x-q-1<<endl;
            swap(str[q],str[x-q-1]);
          ///  cout<<str<<endl;
            r=1;
        }
        else
            r=0;
    }
    cout<<str<<endl;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 300;
char a[N], b[N];
const int M = K * 2;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	p[pn++].init(0, n, 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l < r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l].dir = -p[l].dir;
		l++;
	}
}

void solve() {
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 350;
char a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l < r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l].dir = -p[l++].dir;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 330;
char a[N], b[N];
const int M = K * 2;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	p[pn++].init(0, n, 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l < r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l].dir = -p[l].dir;
		l++;
	}
}

void solve() {
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 350;
char a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l < r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l].dir = -p[l].dir;
		l++;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 350;
char a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l++].dir *= -1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), 1);
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

void direrse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l++].dir *= -1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 0);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		direrse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n, m, pn;
const int K = 330;
char a[N], b[N];
const int M = 500;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	p[pn++].init(0, n, 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l < r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l].dir = -p[l].dir;
		l++;
	}
}

void solve() {
	scanf("%s", &a);
	n = strlen(a);
	scanf("%d", &m);

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		scanf("%d", &l);
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	printf("%s", a);
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += !p[i].rev ? 1 : -1, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;
	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (!p[j].rev ? 1 : -1) * i, p[j].n - i, p[j].rev);
		p[j].init(p[j].i, i, p[j].rev);
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		if (!p[l].rev)
			p[l].i = p[l].i + p[l].n - 1;
		else
			p[l].i = p[l].i - p[l].n + 1;
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 0);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 4;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void init() {
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

void build() {
	n = 0;
	forn(i, pn) {
		if (!p[i].rev)
			memcpy(b + n, a + p[i].i, p[i].n * sizeof(a[0]));
		else {
			memcpy(b + n, a + p[i].i - p[i].n + 1, p[i].n * sizeof(a[0]));
			reverse(b + n, b + n + p[i].n);
		}
		n += p[i].n;
	}
	swap(a, b);
	init();
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;
	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		if (!p[j].rev) {
			p[j + 1].init(p[j].i + i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		else {
			p[j + 1].init(p[j].i - i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		if (!p[l].rev)
			p[l].i = p[l].i + p[l].n - 1;
		else
			p[l].i = p[l].i - p[l].n + 1;
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	init();

	for (int i = 0; i < m; ++i)	{
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			build();
	}
	build();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 2;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void init() {
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

void build() {
	n = 0;
	forn(i, pn) {
		if (!p[i].rev)
			memcpy(b + n, a + p[i].i, p[i].n * sizeof(a[0]));
		else {
			memcpy(b + n, a + p[i].i - p[i].n + 1, p[i].n * sizeof(a[0]));
			reverse(b + n, b + n + p[i].n);
		}
		n += p[i].n;
	}
	swap(a, b);
	init();
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;
	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		if (!p[j].rev) {
			p[j + 1].init(p[j].i + i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		else {
			p[j + 1].init(p[j].i - i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		if (!p[l].rev)
			p[l].i = p[l].i + p[l].n - 1;
		else
			p[l].i = p[l].i - p[l].n + 1;
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	init();

	for (int i = 0; i < m; ++i)	{
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			build();
	}
	build();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void rebuild() {
	n = 0;
	forn(i, pn) {
		if (!p[i].rev)
			memcpy(b + n, a + p[i].i, p[i].n * sizeof(a[0]));
		else {
			memcpy(b + n, a + p[i].i - p[i].n + 1, p[i].n * sizeof(a[0]));
			reverse(b + n, b + n + p[i].n);
		}
		n += p[i].n;
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;
	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		if (!p[j].rev) {
			p[j + 1].init(p[j].i + i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		else {
			p[j + 1].init(p[j].i - i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		if (!p[l].rev)
			p[l].i = p[l].i + p[l].n - 1;
		else
			p[l].i = p[l].i - p[l].n + 1;
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 0);

	for (int i = 0; i < m; ++i)	{
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}