import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        }
        out.flush();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        }
        out.flush();
    }
} Main private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) private static final PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] Args) throws IOException{
        while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        }
        out.flush();
    } main {
        while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        }
        out.flush();
    } while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        } true {
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        } final String str = br.readLine(); str br.readLine() br.readLine br if(str.equals("-")) break; str.equals("-") str.equals str "-" break; final int m = Integer.parseInt(br.readLine()); m Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int h = 0; h 0 for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine()); int i = 0; int i = 0; i 0 i<m i m i++ i++ i h += Integer.parseInt(br.readLine()); h += Integer.parseInt(br.readLine()) h Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br h %= str.length() h str.length() str.length str out.println(str.substring(h)+str.substring(0, h)) out.println out str.substring(h)+str.substring(0, h) str.substring(h) str.substring str h str.substring(0, h) str.substring str 0 h out.flush() out.flush out String[] Args Args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main{
    private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    private static final PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] Args) throws IOException{
        while(true){
            final String str = br.readLine();
            if(str.equals("-")) break;
            final int m = Integer.parseInt(br.readLine());
            int h = 0;
            for(int i = 0; i<m; i++)
                h += Integer.parseInt(br.readLine());
            h %= str.length();
            out.println(str.substring(h)+str.substring(0, h));
        }
        out.flush();
    }
}