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

public class Main {

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

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

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

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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = "";
        while (!(line = br.readLine()).equals("-")) {
            String s = line;
            int n = Integer.parseInt(br.readLine());
            for (int i = 0; i < n; i++) {
                int m = Integer.parseInt(br.readLine());
                s = s.substring(m, s.length()) + s.substring(0, m);
            }
            System.out.println(s);
        }
    }
}