#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  string str;
  cin >> str;
  int len = str.length();
  int n;
  cin >> n;
  char ansarr[200002];
  int arr[n + 1];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  for (int i = 0; i < len; i++) ansarr[i] = str[i];
  int checkarr[200002] = {0};
  for (int i = n - 1; i >= 0; i--) {
    if ((i + 1) % 2 == 0) {
      for (int j = arr[i] - 1; j < len - arr[i] + 1; j++) {
        if (checkarr[j] == 1) break;
        ansarr[j] = str[j];
        checkarr[j] = 1;
      }
      for (int j = len - arr[i]; j >= arr[i]; j--) {
        if (checkarr[j] == 1) break;
        ansarr[j] = str[j];
        checkarr[j] = 1;
      }
    } else {
      for (int j = arr[i] - 1; j < len - arr[i] + 1; j++) {
        if (checkarr[j] == 1) break;
        ansarr[j] = str[len - j - 1];
        checkarr[j] = 1;
      }
      for (int j = len - arr[i]; j >= arr[i]; j--) {
        if (checkarr[j] == 1) break;
        ansarr[j] = str[len - j - 1];
        checkarr[j] = 1;
      }
    }
  }
  for (int i = 0; i < len; i++) cout << ansarr[i];
  cout << endl;
  return 0;
}
