import java.util.Scanner;
public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
} Main public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    } main {
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) String st; st int i i now=0 now 0 m; m while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       } true {
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       } st = s.next() st s.next() s.next s if(st.charAt(0)=='-')break; st.charAt(0)=='-' st.charAt(0) st.charAt st 0 '-' break; m =s.nextInt() m s.nextInt() s.nextInt s for(i=0;i<m;i++){
            now+=s.nextInt();
           } i=0; i=0 i 0 i<m i m i++ i++ i {
            now+=s.nextInt();
           } {
            now+=s.nextInt();
           } now+=s.nextInt() now s.nextInt() s.nextInt s for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           } i=0; i=0 i 0 i<st.length() i st.length() st.length st i++ i++ i {
               System.out.print(st.charAt((now+i)%st.length()));
           } {
               System.out.print(st.charAt((now+i)%st.length()));
           } System.out.print(st.charAt((now+i)%st.length())) System.out.print System.out System System.out st.charAt((now+i)%st.length()) st.charAt st (now+i)%st.length() (now+i) now i st.length() st.length st System.out.println() System.out.println System.out System System.out now=0 now 0 String[] aa aa public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
} public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] aa){
        Scanner s = new Scanner(System.in);
        String st;
        
        int i,now=0,m;
        while(true){
        st = s.next();
        if(st.charAt(0)=='-')break;
        m =s.nextInt();
           for(i=0;i<m;i++){
            now+=s.nextInt();
           }
           for(i=0;i<st.length();i++){
               System.out.print(st.charAt((now+i)%st.length()));
           }
           System.out.println();
           now=0;
       }
    }   
}
