import java.util.Scanner;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n; n int sum; sum while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        } true {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        } String s = sc.next(); s sc.next() sc.next sc if(s.equals("-")) break; s.equals("-") s.equals s "-" break; n = sc.nextInt() n sc.nextInt() sc.nextInt sc sum = 0 sum 0 for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                sum += sc.nextInt();
            } {
                sum += sc.nextInt();
            } sum += sc.nextInt() sum sc.nextInt() sc.nextInt sc int p = sum % s.length(); p sum % s.length() sum s.length() s.length s for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                System.out.print(s.charAt((p + i) % s.length()));
            } {
                System.out.print(s.charAt((p + i) % s.length()));
            } System.out.print(s.charAt((p + i) % s.length())) System.out.print System.out System System.out s.charAt((p + i) % s.length()) s.charAt s (p + i) % s.length() (p + i) p i s.length() s.length s System.out.println() System.out.println System.out System System.out String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    }
} Main
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n;
        int sum;
        while(true) {
            String s = sc.next();
            if(s.equals("-")) break;
            n = sc.nextInt();
            sum = 0;
            for (int i = 0; i < n; i++) {
                sum += sc.nextInt();
            }
            int p = sum % s.length();
            for (int i = 0; i < s.length(); i++) {
                System.out.print(s.charAt((p + i) % s.length()));
            }
            System.out.println();
        }
    }
}
