#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long m, n = s.length();
  cin >> m;
  map<long long, long long> mp;
  while (m--) {
    long long t;
    cin >> t;
    mp[t - 1]++;
  }
  long long prev = -1, parity = 0;
  for (auto [a, b] : mp) {
    if (prev == -1) {
      prev = a;
      parity = b % 2;
      continue;
    }
    if (parity) {
      for (long long i = prev; i < a; i++) {
        swap(s[i], s[n - 1 - i]);
      }
    }
    prev = a;
    parity = (b + parity) % 2;
  }
  if (parity) {
    for (long long i = prev; i < n / 2; i++) {
      swap(s[i], s[n - 1 - i]);
    }
  }
  cout << s;
  return 0;
}
