import java.io.*;
import java.util.*;

public class Deck {
	
	public static void main(String[] args) throws Exception {
		
	
	Scanner in = new Scanner(new File("deck.in"));
	PrintWriter out = new PrintWriter("deck.out");
	String s = in.nextLine();
	char [] c = s.toCharArray();
	int leng = s.length();
	char [] c1 = new char [leng+1];
	
	for (int i = 0; i < leng; i++){
		int t = in.nextInt();
		for(int j = i; j >=t; j--){
			c1[j+1] = c1[j];
		}
		c1[t] = c[i];
	}
	for (int i = 0; i < leng; i++){
		out.print(c1[i]);
	}
	in.close();
	out.close();
	}
}
