import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
 
public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
} import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
} Main static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    } shuffle {
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    } return origin.substring(h , origin.length()) + origin.substring(0 , h); origin.substring(h , origin.length()) + origin.substring(0 , h) origin.substring(h , origin.length()) origin.substring origin h origin.length() origin.length origin origin.substring(0 , h) origin.substring origin 0 h String origin origin int h h public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line; line while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        } !(line=br.readLine()).equals("-") (line=br.readLine()).equals("-") (line=br.readLine()).equals (line=br.readLine()) line br.readLine() br.readLine br "-" {
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        } int times = Integer.parseInt(br.readLine()); times Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            } int i = 0; int i = 0; i 0 i < times i times i++ i++ i {
                line = shuffle(line , Integer.parseInt(br.readLine()));
            } {
                line = shuffle(line , Integer.parseInt(br.readLine()));
            } line = shuffle(line , Integer.parseInt(br.readLine())) line shuffle(line , Integer.parseInt(br.readLine())) shuffle line Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br System.out.println(line) System.out.println System.out System System.out line String[] args args public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
} public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
} Main
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedReader;
 
public class Main{
    static String shuffle(String origin , int h){
        return origin.substring(h , origin.length()) + origin.substring(0 , h);
    }
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line;
 
        while(!(line=br.readLine()).equals("-")){
            int times = Integer.parseInt(br.readLine());
            for(int i = 0; i < times; i++){
                line = shuffle(line , Integer.parseInt(br.readLine()));
            }
            System.out.println(line);
        }
 
    }
}
