/**
 * Created by IntelliJ IDEA.
 * User: m09aaa
 * Date: 28.10.2009
 * Time: 19:07:09
 * To change this template use File | Settings | File Templates.
 */  import java.util.*;
import java.io.*;

public class card {
       public static void main  ( String[] args ) throws Exception
    {
        Scanner in=new Scanner(new File("deck.in"));
        PrintWriter out=new PrintWriter (new File("deck.out"));
        String s=in.next();
        char [] c=s.toCharArray();

        for (int i=0; i<s.length(); i++)
        {
            int x=in.nextInt();
            for (int j=s.length()-1;j>x;j--)
            {
                c[j]=c[j-1];
            }
            c[x]=s.charAt(i);
        }
        String s1="";
        for (int i=0; i<s.length(); i++)
        {
            s1=s1+c[i];
        }
        out.println(s1);
        out.close();
    }
}
