
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			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);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	} main {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		} true {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		} String S = sc.next(); S sc.next() sc.next sc if (S.equals("-")) {
				break;
			} S.equals("-") S.equals S "-" {
				break;
			} break; char[] C = S.toCharArray(); C S.toCharArray() S.toCharArray S int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			} {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			} int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				} int j = 0; int j = 0; j 0 j < h j h j++ j++ j {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				} {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				} for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					} int k = 0; int k = 0; k 0 k < C.length- 1 k C.length- 1 C.length C C.length 1 k++ k++ k {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					} {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					} char l = C[k]; l C[k] C k C[k] = C[k + 1] C[k] C k C[k + 1] C k + 1 k 1 C[k + 1] = l C[k + 1] C k + 1 k 1 l for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			} int i = 0; int i = 0; i 0 i < C.length i C.length C C.length i++ i++ i {
				System.out.print(C[i]);
			} {
				System.out.print(C[i]);
			} System.out.print(C[i]) System.out.print System.out System System.out C[i] C i 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);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			String S = sc.next();
			if (S.equals("-")) {
				break;
			}
			char[] C = S.toCharArray();
			int m = sc.nextInt();
			for (int i = 0; i < m; i++) {
				int h = sc.nextInt();
				for (int j = 0; j < h; j++) {
					for (int k = 0; k < C.length- 1; k++) {
						char l = C[k];
						C[k] = C[k + 1];
						C[k + 1] = l;
					}
				}
			}
			for (int i = 0; i < C.length; i++) {
				System.out.print(C[i]);
			}
			System.out.println();
		}
	}
}

