import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	}

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.next(); str scan.next() scan.next scan int n; n int[] array; array int[] box; box int t; t while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		} str.equals("-") == false str.equals("-") str.equals str "-" false {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		} n = scan.nextInt() n scan.nextInt() scan.nextInt scan array = new int[str.length()] array new int[str.length()] str.length() str.length str box = new int[str.length()] box new int[str.length()] str.length() str.length str for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
				array[i] = i;
			} {
				array[i] = i;
			} array[i] = i array[i] array i i for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			} {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			} t = scan.nextInt() t scan.nextInt() scan.nextInt scan for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				} int j = 0; int j = 0; j 0 j < array.length j array.length array array.length j++ j++ j {
					box[j] = array[(j + t) % array.length];
						
				} {
					box[j] = array[(j + t) % array.length];
						
				} box[j] = array[(j + t) % array.length] box[j] box j array[(j + t) % array.length] array (j + t) % array.length (j + t) j t array.length array array.length for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				} int j = 0; int j = 0; j 0 j < array.length j array.length array array.length j++ j++ j {
					array = (int[])box.clone();
				} {
					array = (int[])box.clone();
				} array = (int[])box.clone() array (int[])box.clone() box.clone box for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			} int j = 0; int j = 0; j 0 j < str.length() j str.length() str.length str j++ j++ j {
				System.out.print(str.charAt(box[j]));
			} {
				System.out.print(str.charAt(box[j]));
			} System.out.print(str.charAt(box[j])) System.out.print System.out System System.out str.charAt(box[j]) str.charAt str box[j] box j System.out.println() System.out.println System.out System System.out str = scan.next() str scan.next() scan.next scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	}

} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	}

} Main
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		int n;
		int[] array; int[] box; int t;
		while (str.equals("-") == false) {
			n = scan.nextInt();
			array = new int[str.length()];
			box = new int[str.length()];
			for (int i = 0; i < str.length(); i++) {
				array[i] = i;
			}
			for (int i = 0; i < n; i++) {
				t = scan.nextInt();
				for (int j = 0; j < array.length; j++) {
					box[j] = array[(j + t) % array.length];
						
				}
				for (int j = 0; j < array.length; j++) {
					array = (int[])box.clone();
				}
				//System.out.println(box[0]+" "+box[1]+" "+box[2]+" "+box[3]+" "+box[4]);
			}
			for (int j = 0; j < str.length(); j++) {
				System.out.print(str.charAt(box[j]));
			}
			System.out.println();
			str = scan.next();
		}
	}

}